Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Apr 23, 2019
1 parent a8b645c commit 7f4b09c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 44 deletions.
21 changes: 3 additions & 18 deletions htdocs/comm/mailing/class/advtargetemailing.class.php
Expand Up @@ -114,22 +114,17 @@ public function create($user, $notrigger = 0)
$error=0;

// Clean parameters
if (isset($this->fk_element)) $this->fk_element=trim($this->fk_element);
if (isset($this->fk_element)) $this->fk_element=(int) $this->fk_element;
if (isset($this->type_element)) $this->type_element=trim($this->type_element);

if (isset($this->name)) $this->name=trim($this->name);
if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue);
if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author);
if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod);



// Check parameters
// Put here code to add control on parameters values

// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."advtargetemailing(";

$sql.= "name,";
$sql.= "entity,";
$sql.= "fk_element,";
Expand All @@ -138,20 +133,15 @@ public function create($user, $notrigger = 0)
$sql.= "fk_user_author,";
$sql.= "datec,";
$sql.= "fk_user_mod";


$sql.= ") VALUES (";

$sql.= " ".(! isset($this->name)?'NULL':"'".$this->db->escape($this->name)."'").",";
$sql.= " ".$conf->entity.",";
$sql.= " ".(! isset($this->fk_element)?'NULL':"'".$this->db->escape($this->fk_element)."'").",";
$sql.= " ".(! isset($this->type_element)?'NULL':"'".$this->db->escape($this->type_element)."'").",";
$sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
$sql.= " ".$user->id.",";
$sql.= " '".$this->db->idate(dol_now())."',";
$sql.= " ".$user->id;


$sql.= " null";
$sql.= ")";

$this->db->begin();
Expand Down Expand Up @@ -396,14 +386,10 @@ public function update($user, $notrigger = 0)
$error=0;

// Clean parameters
if (isset($this->fk_element)) $this->fk_element=trim($this->fk_element);
if (isset($this->fk_element)) $this->fk_element=(int) $this->fk_element;
if (isset($this->type_element)) $this->type_element=trim($this->type_element);
if (isset($this->name)) $this->name=trim($this->name);
if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue);
if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author);
if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod);



// Check parameters
// Put here code to add a control on parameters values
Expand All @@ -417,7 +403,6 @@ public function update($user, $notrigger = 0)
$sql.= " type_element=".(isset($this->type_element)?"'".$this->db->escape($this->type_element)."'":"null").",";
$sql.= " filtervalue=".(isset($this->filtervalue)?"'".$this->db->escape($this->filtervalue)."'":"null").",";
$sql.= " fk_user_mod=".$user->id;

$sql.= " WHERE rowid=".$this->id;

$this->db->begin();
Expand Down
30 changes: 12 additions & 18 deletions htdocs/compta/localtax/class/localtax.class.php
Expand Up @@ -97,9 +97,6 @@ public function create($user)
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);

// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."localtax(";
Expand All @@ -121,9 +118,9 @@ public function create($user)
$sql.= " '".$this->db->escape($this->amount)."',";
$sql.= " '".$this->db->escape($this->label)."',";
$sql.= " '".$this->db->escape($this->note)."',";
$sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->db->escape($this->fk_bank)."'").",";
$sql.= " '".$this->db->escape($this->fk_user_creat)."',";
$sql.= " '".$this->db->escape($this->fk_user_modif)."'";
$sql.= " ".($this->fk_bank <= 0 ? "NULL" : (int) $this->fk_bank).",";
$sql.= " ".((int) $this->fk_user_creat).",";
$sql.= " ".((int) $this->fk_user_modif);
$sql.= ")";

dol_syslog(get_class($this)."::create", LOG_DEBUG);
Expand Down Expand Up @@ -173,9 +170,6 @@ public function update(User $user, $notrigger = 0)
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);

$this->db->begin();

Expand All @@ -188,9 +182,9 @@ public function update(User $user, $notrigger = 0)
$sql.= " amount=".price2num($this->amount).",";
$sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " note='".$this->db->escape($this->note)."',";
$sql.= " fk_bank=".$this->fk_bank.",";
$sql.= " fk_user_creat=".$this->fk_user_creat.",";
$sql.= " fk_user_modif=".$this->fk_user_modif;
$sql.= " fk_bank=".((int) $this->fk_bank).",";
$sql.= " fk_user_creat=".((int) $this->fk_user_creat).",";
$sql.= " fk_user_modif=".((int) $this->fk_user_modif);
$sql.= " WHERE rowid=".$this->id;

dol_syslog(get_class($this)."::update", LOG_DEBUG);
Expand Down Expand Up @@ -299,7 +293,6 @@ public function delete($user)
if ($result < 0) return -1;
// End call triggers


$sql = "DELETE FROM ".MAIN_DB_PREFIX."localtax";
$sql.= " WHERE rowid=".$this->id;

Expand All @@ -324,6 +317,8 @@ public function delete($user)
*/
public function initAsSpecimen()
{
global $user;

$this->id=0;

$this->tms='';
Expand All @@ -333,9 +328,9 @@ public function initAsSpecimen()
$this->amount='';
$this->label='';
$this->note='';
$this->fk_bank='';
$this->fk_user_creat='';
$this->fk_user_modif='';
$this->fk_bank=0;
$this->fk_user_creat=$user->id;
$this->fk_user_modif=$user->id;
}


Expand All @@ -347,7 +342,6 @@ public function initAsSpecimen()
*/
public function solde($year = 0)
{

$reglee = $this->localtax_sum_reglee($year);

$payee = $this->localtax_sum_payee($year);
Expand Down Expand Up @@ -528,7 +522,7 @@ public function addPayment($user)
$sql.= "'".$this->db->idate($this->datev)."'," . $this->amount;
if ($this->note) $sql.=", '".$this->db->escape($this->note)."'";
if ($this->label) $sql.=", '".$this->db->escape($this->label)."'";
$sql.=", '".$user->id."', NULL";
$sql.=", ".((int) $user->id).", NULL";
$sql.= ")";

dol_syslog(get_class($this)."::addPayment", LOG_DEBUG);
Expand Down
12 changes: 4 additions & 8 deletions htdocs/compta/salaries/class/paymentsalary.class.php
Expand Up @@ -115,13 +115,9 @@ public function update($user = null, $notrigger = 0)
$error=0;

// Clean parameters
$this->fk_user=trim($this->fk_user);
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_author=trim($this->fk_user_author);
$this->fk_user_modif=trim($this->fk_user_modif);

// Check parameters
if (empty($this->fk_user) || $this->fk_user < 0)
Expand All @@ -140,16 +136,16 @@ public function update($user = null, $notrigger = 0)
$sql.= " datep='".$this->db->idate($this->datep)."',";
$sql.= " datev='".$this->db->idate($this->datev)."',";
$sql.= " amount=".price2num($this->amount).",";
$sql.= " fk_projet='".$this->db->escape($this->fk_project)."',";
$sql.= " fk_projet=".((int) $this->fk_project).",";
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
$sql.= " num_payment='".$this->db->escape($this->num_payment)."',";
$sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " datesp='".$this->db->idate($this->datesp)."',";
$sql.= " dateep='".$this->db->idate($this->dateep)."',";
$sql.= " note='".$this->db->escape($this->note)."',";
$sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->db->escape($this->fk_bank)."'":"null").",";
$sql.= " fk_user_author=".$this->fk_user_author.",";
$sql.= " fk_user_modif=".$this->fk_user_modif;
$sql.= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : 'null').",";
$sql.= " fk_user_author=".((int) $this->fk_user_author).",";
$sql.= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : 'null');

$sql.= " WHERE rowid=".$this->id;

Expand Down

0 comments on commit 7f4b09c

Please sign in to comment.