Fix: fix not initialized variables

This commit is contained in:
Laurent Destailleur 2011-12-05 19:41:38 +01:00
parent ffaf4e5465
commit b52fc32853
35 changed files with 144 additions and 131 deletions

View File

@ -144,7 +144,9 @@ class pdf_standardlabel {
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
}
}
// Define photo
$photo='';
// Print lines
if ($this->code == "CARD")
{
@ -436,7 +438,7 @@ class pdf_standardlabel {
$filename='tmplabels.pdf';
$type=dol_mimetype($filename);
if ($encoding) header('Content-Encoding: '.$encoding);
//if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');

View File

@ -47,7 +47,7 @@ class mod_project_universal extends ModeleNumRefProjects
$langs->load("projects");
$langs->load("admin");
$form = new Form($db);
$form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -48,7 +48,7 @@ class mod_propale_saphir extends ModeleNumRefPropales
$langs->load("bills");
$form = new Form($db);
$form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -128,7 +128,7 @@ abstract class ModeleNumRefPropales
/**
* Create a document onto disk accordign to template module.
* Create a document onto disk according to template module.
*
* @param DoliDB $db Database handler
* @param Object $object Object proposal
@ -145,6 +145,8 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
global $conf,$user,$langs;
$langs->load("propale");
$error=0;
$dir = "/core/modules/propale/";
$srctemplatepath='';
$modelisok=0;
@ -181,7 +183,7 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
}
// Si model pas encore bon
if (! $modelisok && is_array($liste))
if (! $modelisok)
{
$liste=ModelePDFPropales::liste_modeles($db);
$modele=key($liste); // Renvoie premiere valeur de cle trouve dans le tableau

View File

@ -654,9 +654,9 @@ class pdf_propale_azur extends ModelePDFPropales
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1);
}
// Total LocalTax2
@ -664,9 +664,9 @@ class pdf_propale_azur extends ModelePDFPropales
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1);
}
}
else

View File

@ -654,9 +654,9 @@ class pdf_propale_jaune extends ModelePDFPropales
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1);
}
// Total LocalTax2
@ -664,9 +664,9 @@ class pdf_propale_jaune extends ModelePDFPropales
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1);
}
}
else

View File

@ -88,7 +88,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$langs->load("companies");
$langs->load("errors");
$form = new Form($db);
$form = new Form($this->db);
$texte = $this->description.".<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@ -187,11 +187,10 @@ class doc_generic_odt extends ModeleThirdPartyDoc
{
$id = $object;
$object = new Societe($this->db);
$object->fetch($id);
$result=$object->fetch($id);
if ($result < 0)
{
dol_print_error($db,$object->error);
dol_print_error($this->db,$object->error);
return -1;
}
}

View File

@ -72,7 +72,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
$langs->load("companies");
$form = new Form($db);
$form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -61,7 +61,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$langs->load("companies");
$form = new Form($db);
$form = new Form($this->db);
$tooltip='';
$texte = '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -355,6 +355,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
// Affiche zone totaux
$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
$amount_credit_notes_included=0;
$amount_deposits_included=0;
if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
{
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
@ -423,6 +426,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
// Affichage des totaux de TVA par taux (conformement a reglementation)
$pdf->SetFillColor(248,248,248);
$index=0;
foreach( $this->tva as $tvakey => $tvaval )
{
if ($tvakey > 0) // On affiche pas taux 0
@ -461,9 +465,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1);
}
// Total LocalTax2
@ -471,9 +475,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1);
}
}
else

View File

@ -48,7 +48,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
$langs->load("bills");
$langs->load("admin");
$form = new Form($db);
$form = new Form($this->db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -356,6 +356,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Affiche zone totaux
$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
$amount_credit_notes_included=0;
$amount_deposits_included=0;
if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
{
$this->_tableau_versements($pdf, $object, $posy);
@ -426,6 +428,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Affichage des totaux de TVA par taux (conformement a reglementation)
$pdf->SetFillColor(248,248,248);
$index=0;
foreach( $this->tva as $tvakey => $tvaval )
{
if ($tvakey > 0) // On affiche pas taux 0
@ -465,9 +468,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1);
}
// Total LocalTax2
@ -475,9 +478,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1);
}
}
else

View File

@ -70,6 +70,7 @@ class EcmDirectory // extends CommonObject
{
global $conf, $langs;
$error=0;
$now=dol_now();
// Clean parameters
@ -328,6 +329,8 @@ class EcmDirectory // extends CommonObject
global $conf, $langs;
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$error=0;
$relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3
dol_syslog("EcmDirectories::delete remove directory ".$relativepath);

View File

@ -398,14 +398,14 @@ class Expedition extends CommonObject
}
else
{
dol_syslog('Expedition::Fetch Error rowid='.$rowid.' numrows=0 sql='.$sql);
$this->error='Delivery with id '.$rowid.' not found sql='.$sql;
dol_syslog('Expedition::Fetch Error -2');
$this->error='Delivery with id '.$id.' not found sql='.$sql;
return -2;
}
}
else
{
dol_syslog('Expedition::Fetch Error rowid='.$rowid.' Erreur dans fetch de l\'expedition');
dol_syslog('Expedition::Fetch Error -1');
$this->error=$this->db->error();
return -1;
}
@ -768,8 +768,10 @@ class Expedition extends CommonObject
function delete()
{
global $conf, $langs, $user;
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$error=0;
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";

View File

@ -267,7 +267,7 @@ class Export
$file = "export_".$model.".modules.php";
$classname = "Export".$model;
require_once($dir.$file);
$objmodel = new $classname($db);
$objmodel = new $classname($this->db);
if ($sqlquery) $sql = $sqlquery;
else $sql=$this->build_sql($indice,$array_selected);

View File

@ -309,7 +309,9 @@ class Fichinter extends CommonObject
function setValid($user, $outputdir)
{
global $langs, $conf;
$error=0;
if ($this->statut != 1)
{
$this->db->begin();
@ -578,6 +580,7 @@ class Fichinter extends CommonObject
if (! $this->db->query($sql) )
{
dol_syslog("Fichinter::delete error", LOG_ERR);
$this->error=$this->db->lasterror();
$error++;
}
@ -589,7 +592,7 @@ class Fichinter extends CommonObject
$error++;
}
if ($err > 0)
if ($error)
{
$this->db->rollback();
return -1;

View File

@ -706,6 +706,8 @@ class CommandeFournisseur extends Commande
{
global $conf, $langs;
$error=0;
dol_syslog("CommandeFournisseur::Refuse");
$result = 0;
if ($user->rights->fournisseur->commande->approuver)
@ -750,6 +752,8 @@ class CommandeFournisseur extends Commande
{
global $langs,$conf;
$error=0;
//dol_syslog("CommandeFournisseur::Cancel");
$result = 0;
if ($user->rights->fournisseur->commande->commander)
@ -847,7 +851,8 @@ class CommandeFournisseur extends Commande
global $langs,$conf;
$this->db->begin();
$error=0;
$now=dol_now();
/* On positionne en mode brouillon la commande */
@ -919,6 +924,7 @@ class CommandeFournisseur extends Commande
/**
* Add order line
*
* @param desc Description
* @param pu_ht Unit price
* @param qty Quantity
@ -934,7 +940,7 @@ class CommandeFournisseur extends Commande
* @param type Type of line (0=product, 1=service)
* @return int <=0 if KO, >0 if OK
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0)
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0, $info_bits=0)
{
global $langs,$mysoc;
@ -1134,7 +1140,6 @@ class CommandeFournisseur extends Commande
$error++;
}
}
$i++;
}
if ($error == 0)
@ -1188,13 +1193,14 @@ class CommandeFournisseur extends Commande
/**
* Delete an order
*
* @return int <0 if KO, >0 if OK
* @param User $user Object user
* @return int <0 if KO, >0 if OK
*/
function delete()
function delete($user='')
{
global $langs,$conf;
$err = 0;
$error = 0;
$this->db->begin();
@ -1202,7 +1208,7 @@ class CommandeFournisseur extends Commande
dol_syslog("FournisseurCommande::delete sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql) )
{
$err++;
$error++;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE rowid =".$this->id;
@ -1211,15 +1217,15 @@ class CommandeFournisseur extends Commande
{
if ($this->db->affected_rows($resql) < 1)
{
$err++;
$error++;
}
}
else
{
$err++;
$error++;
}
if ($err == 0)
if ($error == 0)
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
@ -1630,10 +1636,10 @@ class CommandeFournisseur extends Commande
$sql.= ",localtax1_tx='".price2num($txlocaltax1)."'";
$sql.= ",localtax2_tx='".price2num($txlocaltax2)."'";
$sql.= ",qty='".price2num($qty)."'";
if ($date_end) { $sql.= ",date_start='$date_end'"; }
/*if ($date_end) { $sql.= ",date_start='$date_end'"; }
else { $sql.=',date_start=null'; }
if ($date_end) { $sql.= ",date_end='$date_end'"; }
else { $sql.=',date_end=null'; }
else { $sql.=',date_end=null'; }*/
$sql.= ",info_bits='".$info_bits."'";
$sql.= ",total_ht='".price2num($total_ht)."'";
$sql.= ",total_tva='".price2num($total_tva)."'";

View File

@ -82,14 +82,11 @@ class FactureFournisseur extends Facture
/**
* Constructor
*
* @param DoliDB $DB Database handler
* @param DoliDB $db Database handler
*/
function FactureFournisseur($DB)
function FactureFournisseur($db)
{
$this->db = $DB ;
$this->id = $facid;
$this->socid = $socid;
$this->db = $db;
$this->amount = 0;
$this->remise = 0;
@ -115,6 +112,7 @@ class FactureFournisseur extends Facture
{
global $langs,$conf;
$error=0;
$now=dol_now();
// Clear parameters
@ -255,6 +253,7 @@ class FactureFournisseur extends Facture
function fetch($id='',$ref='')
{
global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.facnumber,";
@ -356,8 +355,8 @@ class FactureFournisseur extends Facture
}
else
{
$this->error='Bill with id '.$rowid.' not found sql='.$sql;
dol_syslog(get_class($this).'::Fetch rowid='.$rowid.' numrows=0 sql='.$sql);
$this->error='Bill with id '.$id.' not found sql='.$sql;
dol_syslog(get_class($this).'::Fetch rowid='.$id.' numrows=0 sql='.$sql);
return -2;
}

View File

@ -1354,13 +1354,11 @@ function migrate_price_propal($db,$langs,$conf)
else
{
print "Error id=".$propal->id;
$err++;
}
}
else
{
print "Error #3";
$err++;
}
*/
$i++;
@ -1378,7 +1376,6 @@ function migrate_price_propal($db,$langs,$conf)
else
{
print "Error #1 ".$db->error();
$err++;
$db->rollback();
}
@ -1458,13 +1455,11 @@ function migrate_price_contrat($db,$langs,$conf)
else
{
print "Error id=".$propal->id;
$err++;
}
}
else
{
print "Error #3";
$err++;
}
*/
$i++;
@ -1482,7 +1477,6 @@ function migrate_price_contrat($db,$langs,$conf)
else
{
print "Error #1 ".$db->error();
$err++;
$db->rollback();
}
@ -1560,13 +1554,11 @@ function migrate_price_commande($db,$langs,$conf)
else
{
print "Error id=".$commande->id;
$err++;
}
}
else
{
print "Error #3";
$err++;
}
*/
$i++;
@ -1594,7 +1586,6 @@ function migrate_price_commande($db,$langs,$conf)
else
{
print "Error #1 ".$db->error();
$err++;
$db->rollback();
}
@ -1672,13 +1663,11 @@ function migrate_price_commande_fournisseur($db,$langs,$conf)
else
{
print "Error id=".$commande->id;
$err++;
}
}
else
{
print "Error #3";
$err++;
}
*/
$i++;
@ -1706,7 +1695,6 @@ function migrate_price_commande_fournisseur($db,$langs,$conf)
else
{
print "Error #1 ".$db->error();
$err++;
$db->rollback();
}

View File

@ -293,7 +293,7 @@ class Livraison extends CommonObject
}
else
{
$this->error='Delivery with id '.$rowid.' not found sql='.$sql;
$this->error='Delivery with id '.$id.' not found sql='.$sql;
dol_syslog('Livraison::Fetch Error '.$this->error, LOG_ERR);
return -2;
}
@ -308,12 +308,13 @@ class Livraison extends CommonObject
/**
* Validate object and update stock if option enabled
* @param user Object user that validate
* @return int
*
* @param User $user Object user that validate
* @return int
*/
function valid($user)
{
global $conf;
global $conf, $langs;
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
dol_syslog("livraison.class.php::valid begin");
@ -375,11 +376,11 @@ class Livraison extends CommonObject
if ($resql)
{
// On efface le repertoire de pdf provisoire
$livraisonref = dol_sanitizeFileName($this->ref);
$numref = dol_sanitizeFileName($this->ref);
if ($conf->expedition->dir_output)
{
$dir = $conf->livraison->dir_output . "/" . $livraisonref ;
$file = $dir . "/" . $livraisonref . ".pdf";
$dir = $conf->livraison->dir_output . "/" . $numref ;
$file = $dir . "/" . $numref . ".pdf";
if (file_exists($file))
{
if (!dol_delete_file($file))

View File

@ -155,6 +155,8 @@ function paypaladmin_prepare_head()
$head[$h][2] = 'paypalaccount';
$h++;
$object=(object) array();
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -303,7 +303,7 @@ class ActionsCardProduct extends Product
}
else
{
dol_print_error($db,$sql);
dol_print_error($this->db,$sql);
}
}
@ -441,7 +441,7 @@ class ActionsCardProduct extends Product
}
else
{
dol_print_error($db);
dol_print_error($this->db);
}
}

View File

@ -144,14 +144,13 @@ class Product extends CommonObject
/**
* Constructor
*
* @param DoliDB $DB Database handler
* @param DoliDB $db Database handler
*/
function Product($DB)
function Product($db)
{
global $langs;
$this->db = $DB;
$this->id = $id ;
$this->db = $db;
$this->status = 0;
$this->status_buy = 0;
$this->nbphoto = 0;
@ -403,6 +402,8 @@ class Product extends CommonObject
{
global $langs, $conf;
$error=0;
// Verification parametres
if (! $this->libelle) $this->libelle = 'MISSING LABEL';
@ -881,7 +882,6 @@ class Product extends CommonObject
dol_syslog("Product:get_buyprice ".$this->error, LOG_ERR);
return -2;
}
return $result;
}
@ -2555,11 +2555,12 @@ class Product extends CommonObject
* @param nbbyrow Nombre vignettes par ligne (si mode vignette)
* @param showfilename 1=Show filename
* @param showaction 1=Show icon with action links (resize, delete)
* @param maxheight Max height of image when size=1
* @param maxHeight Max height of image when size=1
* @param maxWidth Max width of image when size=1
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
* TODO Move this into html.formproduct.class.php
*/
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxheight=120)
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160)
{
global $conf,$user,$langs;
@ -2629,17 +2630,17 @@ class Product extends CommonObject
$return.= "\n";
$return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" class="lightbox" target="_blank">';
// Show image (width height=$maxheight)
// Show image (width height=$maxHeight)
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
$alt=$langs->transnoentitiesnoconv('File').': '.$pdir.$photo;
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
if ($photo_vignette && $imgarray['height'] > $maxheight) {
if ($photo_vignette && $imgarray['height'] > $maxHeight) {
$return.= '<!-- Show thumb -->';
$return.= '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
$return.= '<img class="photo" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
}
else {
$return.= '<!-- Show original file -->';
$return.= '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
$return.= '<img class="photo" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
}
$return.= '</a>'."\n";

View File

@ -258,7 +258,7 @@ class Entrepot extends CommonObject
}
else
{
dol_print_error($db);
dol_print_error($this->db);
}
$this->pays=$objp->libelle;
$this->pays_code=$objp->code;

View File

@ -58,7 +58,7 @@ class MouvementStock
*/
function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label='')
{
global $conf;
global $conf, $langs;
$error = 0;
dol_syslog("MouvementStock::_create start userid=$user->id, fk_product=$fk_product, warehouse=$entrepot_id, qty=$qty, type=$type, price=$price label=$label");

View File

@ -74,7 +74,7 @@ class Project extends CommonObject
*/
function create($user, $notrigger=0)
{
global $conf;
global $conf, $langs;
$error = 0;
$ret = 0;
@ -170,7 +170,9 @@ class Project extends CommonObject
function update($user, $notrigger=0)
{
global $langs, $conf;
$error=0;
// Clean parameters
$this->title = trim($this->title);
$this->description = trim($this->description);
@ -496,6 +498,8 @@ class Project extends CommonObject
{
global $langs, $conf;
$error=0;
if ($this->statut != 1)
{
$this->db->begin();
@ -553,6 +557,8 @@ class Project extends CommonObject
{
global $langs, $conf;
$error=0;
if ($this->statut != 2)
{
$this->db->begin();

View File

@ -381,6 +381,7 @@ class Task extends CommonObject
*/
function hasChildren()
{
$error=0;
$ret=0;
$sql = "SELECT COUNT(*) as nb";
@ -664,6 +665,7 @@ class Task extends CommonObject
{
global $conf,$langs;
$error=0;
$ret = 0;
// Clean parameters
@ -781,6 +783,9 @@ class Task extends CommonObject
*/
function updateTimeSpent($user, $notrigger=0)
{
global $conf,$langs;
$error=0;
$ret = 0;
// Clean parameters

View File

@ -149,7 +149,7 @@ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_
$name=$task['task_name'];
for($i=0; $i < $level; $i++) { $name=' &nbsp; &nbsp; '.$name; }
// Add line to gantt
$s = "// Add taks id=".$tasks["task_id"]." level = ".$level."\n";
$s = "// Add taks id=".$task["task_id"]." level = ".$level."\n";
//$s.= "g.AddElementItem(new JSGantt.ElementItem('task',".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '', ".$task['task_milestone'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", ".$parent.", 1".($depend?", ".$depend:"")."));";
$s = "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."'));";
echo $s."\n";

View File

@ -546,7 +546,7 @@ abstract class ActionsCardCommon
{
$head = societe_prepare_head($this->object);
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'company');
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', '', 0, 'company');
$this->tpl['showend']=dol_get_fiche_end();
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom');
@ -595,7 +595,7 @@ abstract class ActionsCardCommon
}
else if ($nbofsalesrepresentative > 0)
{
$userstatic=new User($db);
$userstatic=new User($this->db);
$i=0;
foreach($listsalesrepresentatives as $val)
{

View File

@ -175,6 +175,8 @@ class Societe extends CommonObject
{
global $langs,$conf;
$error=0;
// Clean parameters
if (empty($this->status)) $this->status=0;
$this->name=$this->name?trim($this->name):trim($this->nom);
@ -373,9 +375,10 @@ class Societe extends CommonObject
*/
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update')
{
global $langs,$conf;
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
global $langs,$conf;
$error=0;
dol_syslog("Societe::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);
@ -544,7 +547,7 @@ class Societe extends CommonObject
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($this->db);
$hookmanager->callHooks(array('thirdpartydao'));
$parameters=array('socid'=>$socid);
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
@ -2352,34 +2355,9 @@ class Societe extends CommonObject
}
/**
* Add a line in log table to save status change.
*
* @param $id_status
*/
function set_status($id_status)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_log (datel, fk_soc, fk_statut, fk_user, author, label)";
$sql.= " VALUES ('".$dateaction."', ".$socid.", ".$id_status.",";
$sql.= "'".$user->id."',";
$sql.= "'".$this->db->escape($user->login)."',";
$sql.= "'Change statut from ".$oldstcomm." to ".$stcommid."'";
$sql.= ")";
$result = $thi->db->query($sql);
if ($result)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$stcommid." WHERE rowid=".$socid;
$result = $this->db->query($sql);
}
else
{
$errmesg = $this->db->lasterror();
}
}
/**
* Create a third party into database from a member object
*
* @param member Object member
* @param socname Name of third party to force
* @return int <0 if KO, id of created account if OK

View File

@ -654,6 +654,8 @@ class User extends CommonObject
{
global $user,$conf,$langs;
$error=0;
$this->db->begin();
$this->fetch($this->id);
@ -845,6 +847,8 @@ class User extends CommonObject
{
global $conf,$user,$langs;
$error=0;
// Positionne parametres
$this->admin = 0;
$this->nom = $contact->nom; // TODO deprecated
@ -1358,7 +1362,8 @@ class User extends CommonObject
function send_password($user, $password='', $changelater=0)
{
global $conf,$langs;
global $dolibarr_main_url_root;
require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php";
$subject = $langs->trans("SubjectNewPassword");

View File

@ -480,6 +480,8 @@ class UserGroup extends CommonObject
{
global $user,$conf,$langs;
$error=0;
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_rights";
@ -523,6 +525,7 @@ class UserGroup extends CommonObject
{
global $user, $conf, $langs;
$error=0;
$now=dol_now();
$entity=$conf->entity;

View File

@ -124,6 +124,7 @@ function envoi_mail($oldemail,$message,$total)
$subject = "[Dolibarr] List of unpaid invoices";
$sendto = $oldemail;
$from = $conf->global->MAIN_EMAIL_FROM;
$errorsto = $conf->global->MAIN_MAIL_ERRORS_TO;
$msgishtml = 0;
print "Envoi mail pour $oldemail, total: $total\n";

View File

@ -245,12 +245,12 @@ class CategorieTest extends PHPUnit_Framework_TestCase
$localobject2->initAsSpecimen();
$retarray=$localobject->liste_photos('/');
print __METHOD__." retarry size=".count($rearray)."\n";
print __METHOD__." retarray size=".count($retarray)."\n";
$this->assertTrue(is_array($retarray));
$ret=$localobject->is_fille($localobject2);
print __METHOD__." retarry size=".count($rearray)."\n";
$this->assertFalse($ret);
$retarray=$localobject->is_fille($localobject2);
print __METHOD__." retarry size=".count($retarray)."\n";
$this->assertFalse($retarray);
return $localobject->id;
}
@ -292,7 +292,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
print __METHOD__." retarray size=".count($retarray)."\n";
$this->assertTrue(is_array($retarray));
return $result;
return $retarray;
}
}

View File

@ -187,7 +187,7 @@ class SecurityTest extends PHPUnit_Framework_TestCase
print __METHOD__." encodedstring=".$encodedstring." ".base64_encode($stringtotest)."\n";
$this->assertEquals($stringtotest,$decodedstring);
return $result;
return 0;
}
/**
@ -210,7 +210,7 @@ class SecurityTest extends PHPUnit_Framework_TestCase
print __METHOD__." genpass3=".$genpass3."\n";
$this->assertEquals(strlen($genpass3),8);
return $result;
return 0;
}
}
?>