Fix: fix not initialized variables

This commit is contained in:
Laurent Destailleur 2011-12-05 18:36:54 +01:00
parent b0aff1c927
commit ebea7f6c97
22 changed files with 179 additions and 125 deletions

View File

@ -121,11 +121,12 @@ class Categorie
/**
* Add category into database
*
* @return int -1 : erreur SQL
* -2 : nouvel ID inconnu
* -3 : categorie invalide
* @param User $user Object user
* @return int -1 : erreur SQL
* -2 : nouvel ID inconnu
* -3 : categorie invalide
*/
function create()
function create($user='')
{
global $conf,$langs;
$langs->load('categories');
@ -203,11 +204,12 @@ class Categorie
/**
* Update category
*
* @return int 1 : OK
* -1 : SQL error
* -2 : invalid category
* @param User $user Object user
* @return int 1 : OK
* -1 : SQL error
* -2 : invalid category
*/
function update()
function update($user='')
{
global $conf, $langs;
@ -883,12 +885,12 @@ class Categorie
$sql.= " AND c.label='".$this->db->escape($this->label)."'";
}
dol_syslog("Categorie::already_exists sql=".$sql);
$res = $this->db->query($sql);
if ($res)
$resql = $this->db->query($sql);
if ($resql)
{
if($this->db->num_rows($resql) > 0) // Checking for empty resql
if ($this->db->num_rows($resql) > 0) // Checking for empty resql
{
$obj = $this->db->fetch_array($res);
$obj = $this->db->fetch_array($resql);
/* If object called create, obj cannot have is id.
* If object called update, he mustn't have the same label as an other category for this mother.
* So if the result have the same id, update is not for label, and if result have an other one,

View File

@ -381,7 +381,6 @@ class Propal extends CommonObject
$this->line->subprice=$pu_ht;
$this->line->rang=$rangtouse;
$this->line->info_bits=$info_bits;
$this->line->fk_remise_except=$fk_remise_except;
$this->line->total_ht=$total_ht;
$this->line->total_tva=$total_tva;
$this->line->total_localtax1=$total_localtax1;
@ -1149,6 +1148,7 @@ class Propal extends CommonObject
{
global $conf,$langs;
$error=0;
$now=dol_now();
if ($user->rights->propale->valider)
@ -1477,7 +1477,8 @@ class Propal extends CommonObject
global $langs,$conf;
$this->statut = $statut;
$error=0;
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
@ -2536,13 +2537,17 @@ class PropaleLigne
}
/**
* \brief Insert object line propal in database
* \return int <0 if KO, >0 if OK
* Insert object line propal in database
*
* @param int $notrigger 1=no trigger ran
* @return int <0 if KO, >0 if OK
*/
function insert($notrigger=0)
{
global $conf,$langs,$user;
$error=0;
dol_syslog("PropaleLigne::insert rang=".$this->rang);
// Clean parameters
@ -2599,8 +2604,6 @@ class PropaleLigne
$resql=$this->db->query($sql);
if ($resql)
{
$this->rang=$rangmax;
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet');
if (! $notrigger)
{
@ -2632,6 +2635,7 @@ class PropaleLigne
{
global $conf,$langs,$user;
$error=0;
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$this->rowid;
@ -2667,6 +2671,8 @@ class PropaleLigne
{
global $conf,$langs,$user;
$error=0;
// Clean parameters
if (empty($this->tva_tx)) $this->tva_tx=0;
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;

View File

@ -99,15 +99,13 @@ class Commande extends CommonObject
/**
* Constructor
*
* @param DoliDB $DB Database handler
* @param DoliDB $db Database handler
*/
function Commande($DB)
function Commande($db)
{
global $langs;
$langs->load('orders');
$this->db = $DB;
$this->socid = $socid;
$this->id = $commandeid;
$this->db = $db;
$this->remise = 0;
$this->remise_percent = 0;
@ -447,9 +445,10 @@ class Commande extends CommonObject
}
/**
* Close order
* @param user Objet user that close
* @return int <0 if KO, >0 if OK
* Close order
*
* @param user Objet user that close
* @return int <0 if KO, >0 if OK
*/
function cloture($user)
{
@ -501,13 +500,15 @@ class Commande extends CommonObject
}
/**
* \brief Cancel an order
* \return int <0 if KO, >0 if OK
* \remarks If stock is decremented on order validation, we must reincrement it
* Cancel an order
* If stock is decremented on order validation, we must reincrement it
*
* @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK
*/
function cancel($user)
function cancel($user, $idwarehouse=-1)
{
global $conf;
global $conf,$langs;
$error=0;
@ -526,17 +527,20 @@ class Commande extends CommonObject
// If stock is decremented on validate order, we must reincrement it
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
{
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$langs->load("agenda");
if ($this->lines[$i]->fk_product > 0)
{
$mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products)
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref));
if ($result < 0) { $error++; }
}
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$langs->load("agenda");
$num=count($this->lines);
for ($i = 0; $i < $num; $i++)
{
if ($this->lines[$i]->fk_product > 0)
{
$mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products)
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref));
if ($result < 0) { $error++; }
}
}
}
if (! $error)
@ -604,7 +608,6 @@ class Commande extends CommonObject
dol_syslog("Commande::create ".$this->error, LOG_ERR);
return -1;
}
if (! $remise) $remise=0;
if (! $this->fk_project) $this->fk_project = 0;
// $date_commande is deprecated
@ -1299,14 +1302,14 @@ class Commande extends CommonObject
}
else
{
dol_syslog('Commande::Fetch Error rowid='.$rowid.' numrows=0 sql='.$sql);
$this->error='Order with id '.$rowid.' not found sql='.$sql;
dol_syslog('Commande::Fetch Error rowid='.$id.' numrows=0 sql='.$sql);
$this->error='Order with id '.$id.' not found sql='.$sql;
return -2;
}
}
else
{
dol_syslog('Commande::Fetch Error rowid='.$rowid.' Erreur dans fetch de la commande');
dol_syslog('Commande::Fetch Error rowid='.$id.' Erreur dans fetch de la commande');
$this->error=$this->db->error();
return -1;
}
@ -2194,8 +2197,8 @@ class Commande extends CommonObject
$qty=price2num($qty);
$pu = price2num($pu);
$txtva=price2num($txtva);
$txlocaltax1=price2num($txtlocaltax1);
$txlocaltax2=price2num($txtlocaltax2);
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
// Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva
@ -2287,15 +2290,16 @@ class Commande extends CommonObject
/**
* Delete the customer order
* @param user User object
* @return int <=0 if KO, >0 if OK
*
* @param User $user User object
* @return int <=0 if KO, >0 if OK
*/
function delete($user)
{
global $conf, $langs;
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$err = 0;
$error = 0;
$this->db->begin();
@ -2305,7 +2309,7 @@ class Commande extends CommonObject
if (! $this->db->query($sql) )
{
dol_syslog("CustomerOrder::delete error", LOG_ERR);
$err++;
$error++;
}
// Delete order
@ -2314,7 +2318,7 @@ class Commande extends CommonObject
if (! $this->db->query($sql) )
{
dol_syslog("CustomerOrder::delete error", LOG_ERR);
$err++;
$error++;
}
// Delete linked object
@ -2326,7 +2330,7 @@ class Commande extends CommonObject
if (! $this->db->query($sql) )
{
dol_syslog("CustomerOrder::delete error", LOG_ERR);
$err++;
$error++;
}
// Delete linked contacts
@ -2334,7 +2338,7 @@ class Commande extends CommonObject
if ($res < 0)
{
dol_syslog("CustomerOrder::delete error", LOG_ERR);
$err++;
$error++;
}
// On efface le repertoire de pdf provisoire
@ -2365,7 +2369,7 @@ class Commande extends CommonObject
}
}
if ($err == 0)
if ($error == 0)
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
@ -2387,6 +2391,7 @@ class Commande extends CommonObject
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param user Objet user
* @return int <0 if KO, >0 if OK
*/
@ -2935,6 +2940,8 @@ class OrderLine
{
global $conf, $user, $langs;
$error=0;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';";
dol_syslog("OrderLine::delete sql=".$sql);
@ -2968,6 +2975,8 @@ class OrderLine
{
global $langs, $conf, $user;
$error=0;
dol_syslog("OrderLine::insert rang=".$this->rang);
// Clean parameters
@ -3065,6 +3074,8 @@ class OrderLine
{
global $conf,$langs,$user;
$error=0;
// Clean parameters
if (empty($this->tva_tx)) $this->tva_tx=0;
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;

View File

@ -864,7 +864,6 @@ class Account extends CommonObject
{
$this->nbtodo++;
if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) $this->nbtodolate++;
if ($obj->rappro) $foundaccounttoconciliate++;
}
return $num;
}

View File

@ -182,8 +182,8 @@ class Don extends CommonObject
$this->specimen=1;
$this->nom = 'Doe';
$this->prenom = 'John';
$this->socid = $socids[$socid];
$this->date = time();
$this->socid = 1;
$this->date = dol_now();
$this->amount = 100;
$this->public = 1;
$this->societe = 'The Company';

View File

@ -190,9 +190,10 @@ class FactureRec extends Facture
/**
* \brief Recupere l'objet facture et ses lignes de factures
* \param rowid id de la facture a recuperer
* \return int >0 si ok, <0 si ko
* Recupere l'objet facture et ses lignes de factures
*
* @param int $rowid Id de la facture a recuperer
* @return int >0 si ok, <0 si ko
*/
function fetch($rowid)
{
@ -209,7 +210,7 @@ class FactureRec extends Facture
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'"; // TODO remplacer par une fonction
$sql.= ' WHERE f.rowid='.$rowid;
dol_syslog("FactureRec::Fetch rowid=".$rowid.", societe_id=".$socid." sql=".$sql, LOG_DEBUG);
dol_syslog("FactureRec::Fetch rowid=".$rowid." sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
@ -404,7 +405,9 @@ class FactureRec extends Facture
/**
* \brief Add a line to invoice
* Add a line to invoice
*
* @return int <0 if KO, >0 if OK
*/
function addline($facid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0)
{
@ -420,7 +423,6 @@ class FactureRec extends Facture
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
if (! $qty) $qty=1;
if (! $ventil) $ventil=0;
if (! $info_bits) $info_bits=0;
$pu_ht=price2num($pu_ht);
$pu_ttc=price2num($pu_ttc);

View File

@ -1395,6 +1395,8 @@ class Facture extends CommonObject
{
global $conf,$langs;
$error=0;
dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG);
$this->db->begin();
@ -1515,7 +1517,7 @@ class Facture extends CommonObject
$result=$facreplaced->set_canceled($user,'replaced','');
if ($result < 0)
{
$this->error=$facreplaced->error." sql=".$sql;
$this->error=$facreplaced->error;
$this->db->rollback();
return -13;
}
@ -3420,6 +3422,8 @@ class FactureLigne
{
global $langs,$user,$conf;
$error=0;
dol_syslog(get_class($this)."::Insert rang=".$this->rang, LOG_DEBUG);
// Clean parameters
@ -3562,12 +3566,16 @@ class FactureLigne
/**
* Update line into database
*
* @return int <0 if KO, >0 if OK
* @param User $user User object
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function update()
function update($user='',$notrigger=0)
{
global $user,$langs,$conf;
$error=0;
// Clean parameters
$this->desc=trim($this->desc);
if (empty($this->tva_tx)) $this->tva_tx=0;
@ -3651,6 +3659,8 @@ class FactureLigne
{
global $conf,$langs,$user;
$error=0;
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid;

View File

@ -63,6 +63,8 @@ class localtax extends CommonObject
{
global $conf, $langs;
$error=0;
// Clean parameters
$this->amount=trim($this->amount);
$this->label=trim($this->label);
@ -128,6 +130,8 @@ class localtax extends CommonObject
{
global $conf, $langs;
$error=0;
// Clean parameters
$this->amount=trim($this->amount);
$this->label=trim($this->label);
@ -245,6 +249,8 @@ class localtax extends CommonObject
{
global $conf, $langs;
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."localtax";
$sql.= " WHERE rowid=".$this->id;
@ -493,7 +499,7 @@ class localtax extends CommonObject
$acc = new Account($this->db);
$result=$acc->fetch($this->accountid);
if ($result <= 0) dol_print_error($db);
if ($result <= 0) dol_print_error($this->db);
$bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs($this->amount), '', '', $user);

View File

@ -471,6 +471,7 @@ class RemiseCheque extends CommonObject
/**
* Build document
*
* @param model Model name
* @param outputlangs Object langs
* @return int <0 if KO, >0 if OK
@ -493,7 +494,7 @@ class RemiseCheque extends CommonObject
require_once($dir.$file);
$classname='BordereauCheque'.ucfirst($model);
$docmodel = new $classname($db);
$docmodel = new $classname($this->db);
$sql = "SELECT b.banque, b.emetteur, b.amount, b.num_chq";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
@ -535,14 +536,14 @@ class RemiseCheque extends CommonObject
$result=$docmodel->write_file($conf->banque->dir_output.'/bordereau', $this->number, $outputlangs);
if ($result > 0)
{
$outputlangs->charset_output=$sav_charset_output;
//$outputlangs->charset_output=$sav_charset_output;
return 1;
}
else
{
$outputlangs->charset_output=$sav_charset_output;
//$outputlangs->charset_output=$sav_charset_output;
dol_syslog("Error");
dol_print_error($db,$docmodel->error);
dol_print_error($this->db,$docmodel->error);
return 0;
}
}

View File

@ -320,7 +320,7 @@ class BonPrelevement extends CommonObject
{
global $user,$conf;
$error == 0;
$error = 0;
if ($this->db->begin())
{
@ -401,7 +401,7 @@ class BonPrelevement extends CommonObject
{
global $conf,$langs;
$error == 0;
$error = 0;
if ($this->_fetched == 1)
{
@ -525,7 +525,8 @@ class BonPrelevement extends CommonObject
{
global $conf,$langs;
$error == 0;
$error = 0;
dol_syslog("bon-prelevement::set_infotrans Start",LOG_INFO);
if ($this->db->begin())
{

View File

@ -74,8 +74,9 @@ class Tva extends CommonObject
{
global $conf, $langs;
$error=0;
// Clean parameters
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
@ -83,14 +84,11 @@ class Tva extends CommonObject
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters
// Put here code to add control on parameters values
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva(";
$sql.= "tms,";
$sql.= "datep,";
$sql.= "datev,";
@ -148,8 +146,9 @@ class Tva extends CommonObject
{
global $conf, $langs;
$error=0;
// Clean parameters
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
@ -157,8 +156,6 @@ class Tva extends CommonObject
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters
// Put here code to add control on parameters values
@ -275,6 +272,8 @@ class Tva extends CommonObject
{
global $conf, $langs;
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."tva";
$sql.= " WHERE rowid=".$this->id;
@ -522,7 +521,7 @@ class Tva extends CommonObject
$acc = new Account($this->db);
$result=$acc->fetch($this->accountid);
if ($result <= 0) dol_print_error($db);
if ($result <= 0) dol_print_error($this->db);
$bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs($this->amount), '', '', $user);

View File

@ -92,10 +92,11 @@ abstract class ActionsContactCardCommon
/**
* Load data control
*
* @param int $id Id of object
* @param string &$action Type of action
* @param int $id Id of object
* @return void
*/
function doActions(&$action)
function doActions(&$action, $id)
{
global $conf, $user, $langs;
@ -397,11 +398,7 @@ abstract class ActionsContactCardCommon
include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php');
$login=dol_buildlogin($this->object->nom, $this->object->prenom);
$generated_password='';
if (! $ldap_sid)
{
$generated_password=getRandomPassword('');
}
$generated_password=getRandomPassword('');
$password=$generated_password;
// Create a form array

View File

@ -867,13 +867,13 @@ class Contact extends CommonObject
$code=$this->civilite_id;
return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : '';
if (empty($ret))
/*if (empty($ret))
{
$ret=$code;
$langs->getLabelFromKey($db,$reg[1],'c_civilite','code','civilite');
$langs->getLabelFromKey($this->db,$reg[1],'c_civilite','code','civilite');
//$ret=dol_getIdFromCode($this->db,$code,'c_civilite',
}
return $ret;
return $ret;*/
}

View File

@ -145,6 +145,8 @@ class Contrat extends CommonObject
{
global $langs,$conf;
$error=0;
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 4,";
@ -191,6 +193,8 @@ class Contrat extends CommonObject
{
global $langs,$conf;
$error=0;
// statut actif : 4
$this->db->begin();
@ -225,11 +229,12 @@ class Contrat extends CommonObject
/**
* \brief Close all lines of a contract
* \param user Object User making action
* \param langs Object Lang
* \param conf Object Conf
*
* Close all lines of a contract
*
* @param user Object User making action
* @param langs Object Lang
* @param conf Object Conf
* @return void
*/
function cloture($user,$langs='',$conf='')
{
@ -268,7 +273,7 @@ class Contrat extends CommonObject
}
else
{
dol_print_error($db,'Error in cloture function');
dol_print_error($this->db,'Error in cloture function');
$this->db->rollback();
}
}
@ -282,6 +287,8 @@ class Contrat extends CommonObject
*/
function validate($user,$langs,$conf)
{
$error=0;
$sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET statut = 1";
$sql .= " WHERE rowid = ".$this->id . " AND statut = 0";
@ -835,7 +842,6 @@ class Contrat extends CommonObject
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
if (! $qty) $qty=1;
if (! $ventil) $ventil=0;
if (! $info_bits) $info_bits=0;
if (! $pu_ht) $pu_ht=0;
if (! $pu_ttc) $pu_ttc=0;
@ -883,7 +889,7 @@ class Contrat extends CommonObject
$sql.= " price_ht, remise"; // TODO A virer
if ($date_start > 0) { $sql.= ",date_ouverture_prevue"; }
if ($date_end > 0) { $sql.= ",date_fin_validite"; }
$sql.= ") VALUES ($this->id, '" . $this->db->escape($label) . "','" . $this->db->escape($desc) . "',";
$sql.= ") VALUES ($this->id, '', '" . $this->db->escape($desc) . "',";
$sql.= ($fk_product>0 ? $fk_product : "null").",";
$sql.= " '".$qty."',";
$sql.= " '".$txtva."',";
@ -1031,6 +1037,8 @@ class Contrat extends CommonObject
{
global $conf, $langs;
$error=0;
if ($this->statut >= 0)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet";
@ -1105,9 +1113,9 @@ class Contrat extends CommonObject
$langs->load("contracts");
if ($mode == 0)
{
if ($statut == 0) { return $langs->trans("ContractStatusDraft").$text; }
if ($statut == 1) { return $langs->trans("ContractStatusValidated").$text; }
if ($statut == 2) { return $langs->trans("ContractStatusClosed").$text; }
if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
if ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
if ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
}
if ($mode == 1)
{
@ -1762,6 +1770,8 @@ class ContratLigne
{
global $conf, $langs;
$error=0;
// Clean parameters
$this->fk_contrat=trim($this->fk_contrat);
$this->fk_product=trim($this->fk_product);

View File

@ -43,13 +43,15 @@ class box_external_rss extends ModeleBoxes {
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function box_external_rss($DB,$param)
function box_external_rss($db,$param)
{
global $langs;
$langs->load("boxes");
$this->db=$DB;
$this->db=$db;
$this->param=$param;
$this->boxlabel=$langs->trans("BoxLastRssInfos");
@ -80,7 +82,7 @@ class box_external_rss extends ModeleBoxes {
// Get RSS feed
$url=@constant("EXTERNAL_RSS_URLRSS_".$site);
$rssparser=new RssParser($db);
$rssparser=new RssParser($this->db);
$result = $rssparser->parser($url, $this->max, $cachedelay, $conf->externalrss->dir_temp);
// INFO on channel

View File

@ -81,6 +81,8 @@ abstract class CommonObject
{
global $user,$conf,$langs;
$error=0;
dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source");
// Check parameters
@ -200,6 +202,8 @@ abstract class CommonObject
{
global $user,$langs,$conf;
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sql.= " WHERE rowid =".$rowid;
@ -2055,7 +2059,7 @@ abstract class CommonObject
// Produit
if ($line->fk_product > 0)
{
$product_static = new Product($db);
$product_static = new Product($this->db);
$product_static->type=$line->fk_product_type;
$product_static->id=$line->fk_product;
@ -2164,7 +2168,7 @@ abstract class CommonObject
if (($line->info_bits & 2) == 2) // TODO Not sure this is used for source object
{
$discount=new DiscountAbsolute($db);
$discount=new DiscountAbsolute($this->db);
$discount->fk_soc = $this->socid;
$this->tpl['label'].= $discount->getNomUrl(0,'discount');
}

View File

@ -208,7 +208,7 @@ class DiscountAbsolute
}
else
{
dol_print_error($db);
dol_print_error($this->db);
return -1;
}
}

View File

@ -1036,7 +1036,7 @@ class Form
if ($num)
{
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').'>';
if ($show_empty) $out.= '<option value="-1"'.($id==-1?' selected="selected"':'').'>&nbsp;</option>'."\n";
if ($show_empty) $out.= '<option value="-1"'.($selected==-1?' selected="selected"':'').'>&nbsp;</option>'."\n";
$userstatic=new User($this->db);
@ -1364,6 +1364,8 @@ class Form
function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtertype='',$filtre)
{
global $langs,$conf;
global $price_level, $status, $finished;
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
{
// mode=2 means suppliers products
@ -1521,7 +1523,7 @@ class Form
}
else
{
dol_print_error($db);
dol_print_error($this->db);
}
}
@ -1610,7 +1612,7 @@ class Form
}
else
{
dol_print_error($db);
dol_print_error($this->db);
}
}
@ -3806,7 +3808,7 @@ class Form
if ($num)
{
$out.= '<select class="flat" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').'>';
if ($show_empty) $out.= '<option value="-1"'.($id==-1?' selected="selected"':'').'>&nbsp;</option>'."\n";
if ($show_empty) $out.= '<option value="-1"'.($selected==-1?' selected="selected"':'').'>&nbsp;</option>'."\n";
while ($i < $num)
{

View File

@ -358,7 +358,7 @@ class FormFile
$headershown=1;
$form = new Form($db);
$form = new Form($this->db);
$buttonlabeltoshow=$buttonlabel;
if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate');
@ -537,7 +537,7 @@ class FormFile
{
global $user, $conf, $langs;
global $bc;
global $sortfield, $sortorder;
global $sortfield, $sortorder, $maxheightmini;
// Show list of existing files
if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));

View File

@ -223,7 +223,7 @@ class FormMail
if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]);
$form=new Form($DB);
$form=new Form($this->db);
$out.= "\n<!-- Debut form mail -->\n";
if ($this->withform)

View File

@ -357,10 +357,11 @@ class pdf_standard {
/**
* \brief Function to build PDF on disk, then output on HTTP strem.
* \param arrayofmembers Array of members informations
* \param outputlangs Lang object for output language
* \return int 1=ok, 0=ko
* Function to build PDF on disk, then output on HTTP strem.
*
* @param arrayofmembers Array of members informations
* @param outputlangs Lang object for output language
* @return int 1=ok, 0=ko
*/
function write_file($arrayofmembers,$outputlangs)
{
@ -457,7 +458,7 @@ class pdf_standard {
$filename='tmpcards.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

@ -75,8 +75,9 @@ class ActionsCardCompany extends ActionsCardCommon
/**
* Execute actions
*
* @param int $socid Id of object (may be empty for creation)
* @return int <0 if KO, >0 if OK
* @param string &$action Type of action
* @param int $id Id of object
* @return int <0 if KO, >0 if OK
*/
function doActions(&$action, $id)
{