Clean some constructors

This commit is contained in:
Laurent Destailleur 2020-05-07 12:14:45 +02:00
parent 6c8d302dd9
commit 03fddd48af
12 changed files with 20 additions and 23 deletions

View File

@ -54,7 +54,7 @@ $statut = GETPOST('statut', 'int');
$search_ref = GETPOST('search_ref', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
$bon = new BonPrelevement($db, "");
$bon = new BonPrelevement($db);
$hookmanager->initHooks(array('withdrawalsreceiptslist'));

View File

@ -58,7 +58,7 @@ $pagenext = $page + 1;
if (!$sortfield) $sortfield = 'pl.fk_soc';
if (!$sortorder) $sortorder = 'DESC';
$object = new BonPrelevement($db, "");
$object = new BonPrelevement($db);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
@ -321,7 +321,7 @@ if ($id > 0 || $ref)
}
$ligne = new LignePrelevement($db, $user);
$ligne = new LignePrelevement($db);
/*
* Lines into withdraw request

View File

@ -83,18 +83,16 @@ class BonPrelevement extends CommonObject
* Constructor
*
* @param DoliDB $db Database handler
* @param string $filename Filename of withdraw receipt
*/
public function __construct($db, $filename = '')
public function __construct($db)
{
global $conf, $langs;
$error = 0;
$this->db = $db;
$this->filename = $filename;
$this->filename = '';
$this->date_echeance = time();
$this->date_echeance = dol_now();
$this->raison_sociale = "";
$this->reference_remise = "";
@ -892,7 +890,7 @@ class BonPrelevement extends CommonObject
if ($bac->verif() >= 1)
{
$factures_prev[$i] = $fac;
/* second tableau necessaire pour BonPrelevement */
/* second array necessary for BonPrelevement */
$factures_prev_id[$i] = $fac[0];
$i++;
//dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG);

View File

@ -48,14 +48,12 @@ class LignePrelevement
* Constructor
*
* @param DoliDb $db Database handler
* @param User $user Objet user
*/
public function __construct($db, $user)
public function __construct($db)
{
global $conf, $langs;
$this->db = $db;
$this->user = $user;
// List of language codes for status

View File

@ -247,6 +247,7 @@ class RejetPrelevement
$sendto = $emuser->getFullName($langs)." <".$emuser->email.">";
$from = $this->user->getFullName($langs)." <".$this->user->email.">";
$msgishtml = 1;
$trackid = 'use'.$emuser->id;
$arr_file = array();
$arr_mime = array();
@ -258,7 +259,7 @@ class RejetPrelevement
$message = $langs->trans("InfoRejectMessage", $facref, $socname, $amount, $userinfo);
$mailfile = new CMailFile($subject, $sendto, $from, $message, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $this->user->email);
$mailfile = new CMailFile($subject, $sendto, $from, $message, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $this->user->email, '', $trackid);
$result = $mailfile->sendfile();
if ($result)

View File

@ -53,7 +53,7 @@ $pagenext = $page + 1;
if (!$sortfield) $sortfield = 'p.ref';
if (!$sortorder) $sortorder = 'DESC';
$object = new BonPrelevement($db, "");
$object = new BonPrelevement($db);

View File

@ -51,7 +51,7 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$object = new BonPrelevement($db, "");
$object = new BonPrelevement($db);

View File

@ -50,7 +50,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
$object = new BonPrelevement($db, "");
$object = new BonPrelevement($db);
/*
@ -142,7 +142,7 @@ if ($prev_id > 0 || $ref)
/*
* Stats
*/
$ligne = new LignePrelevement($db, $user);
$ligne = new LignePrelevement($db);
$sql = "SELECT sum(pl.amount), pl.statut";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";

View File

@ -90,7 +90,7 @@ if ($action == 'confirm_rejet')
if (!$error)
{
$lipre = new LignePrelevement($db, $user);
$lipre = new LignePrelevement($db);
if ($lipre->fetch($id) == 0)
@ -132,7 +132,7 @@ $h++;
if ($id)
{
$lipre = new LignePrelevement($db, $user);
$lipre = new LignePrelevement($db);
if ($lipre->fetch($id) == 0)
{

View File

@ -64,8 +64,8 @@ $search_code = GETPOST('search_code', 'alpha');
$search_company = GETPOST('search_company', 'alpha');
$statut = GETPOST('statut', 'int');
$bon = new BonPrelevement($db, "");
$line = new LignePrelevement($db, $user);
$bon = new BonPrelevement($db);
$line = new LignePrelevement($db);
$company = new Societe($db);
$hookmanager->initHooks(array('withdrawalsreceiptslineslist'));

View File

@ -57,7 +57,7 @@ if ($sortorder == "") $sortorder = "DESC";
if ($sortfield == "") $sortfield = "p.datec";
$rej = new RejetPrelevement($db, $user);
$line = new LignePrelevement($db, $user);
$line = new LignePrelevement($db);
$hookmanager->initHooks(array('withdrawalsreceiptsrejectedlist'));

View File

@ -73,7 +73,7 @@ if ($resql)
print '<br>';
print load_fiche_titre($langs->trans("WithdrawStatistics"), '', '');
$ligne = new LignePrelevement($db, $user);
$ligne = new LignePrelevement($db);
$sql = "SELECT sum(pl.amount), count(pl.amount), pl.statut";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";