Add more robust php unit to detect not escaped sql. Fix not escaped sql

This commit is contained in:
Laurent Destailleur
2017-09-15 15:41:07 +02:00
parent 77056d9adb
commit 5e34b121dd
63 changed files with 420 additions and 438 deletions

View File

@@ -26,7 +26,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/**
/**
* Classe permettant la gestion des paiements des charges
* La tva collectee n'est calculee que sur les factures payees.
*/
@@ -36,7 +36,7 @@ class ChargeSociales extends CommonObject
public $table='chargesociales';
public $table_element='chargesociales';
public $picto = 'bill';
/**
* {@inheritdoc}
*/
@@ -110,7 +110,7 @@ class ChargeSociales extends CommonObject
$this->paye = $obj->paye;
$this->periode = $this->db->jdate($obj->periode);
$this->import_key = $this->import_key;
$this->db->free($resql);
return 1;
@@ -171,8 +171,8 @@ class ChargeSociales extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, date_creation)";
$sql.= " VALUES (".$this->type;
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
$sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"NULL");
$sql.= ", ".($this->fk_account>0 ? $this->fk_account:'NULL');
$sql.= ", ".($this->mode_reglement_id>0 ? $this->mode_reglement_id:"NULL");
$sql.= ", '".$this->db->escape($this->lib)."'";
$sql.= ", '".$this->db->idate($this->date_ech)."'";
$sql.= ", '".$this->db->idate($this->periode)."'";
@@ -378,7 +378,7 @@ class ChargeSociales extends CommonObject
if ($return) return 1;
else return -1;
}
/**
* Retourne le libelle du statut d'une charge (impaye, payee)
*
@@ -445,7 +445,7 @@ class ChargeSociales extends CommonObject
if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
}
return "Error, mode/status not found";
}