Clean code
This commit is contained in:
parent
3b6559b1a6
commit
46d993c9a6
@ -261,7 +261,7 @@ if ($action == 'create') {
|
|||||||
// autosuggest from existing account types if found
|
// autosuggest from existing account types if found
|
||||||
print '<datalist id="pcg_type_datalist">';
|
print '<datalist id="pcg_type_datalist">';
|
||||||
$sql = 'SELECT DISTINCT pcg_type FROM ' . MAIN_DB_PREFIX . 'accounting_account';
|
$sql = 'SELECT DISTINCT pcg_type FROM ' . MAIN_DB_PREFIX . 'accounting_account';
|
||||||
$sql .= ' WHERE fk_pcg_version = "' . $db->escape($accountsystem->ref) . '"';
|
$sql .= " WHERE fk_pcg_version = '" . $db->escape($accountsystem->ref) . "'";
|
||||||
$sql .= ' AND entity in ('.getEntity('accounting_account', 0).')'; // Always limit to current entity. No sharing in accountancy.
|
$sql .= ' AND entity in ('.getEntity('accounting_account', 0).')'; // Always limit to current entity. No sharing in accountancy.
|
||||||
$sql .= ' LIMIT 50000'; // just as a sanity check
|
$sql .= ' LIMIT 50000'; // just as a sanity check
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -337,7 +337,7 @@ if ($action == 'create') {
|
|||||||
// autosuggest from existing account types if found
|
// autosuggest from existing account types if found
|
||||||
print '<datalist id="pcg_type_datalist">';
|
print '<datalist id="pcg_type_datalist">';
|
||||||
$sql = 'SELECT DISTINCT pcg_type FROM ' . MAIN_DB_PREFIX . 'accounting_account';
|
$sql = 'SELECT DISTINCT pcg_type FROM ' . MAIN_DB_PREFIX . 'accounting_account';
|
||||||
$sql .= ' WHERE fk_pcg_version = "' . $db->escape($accountsystem->ref) . '"';
|
$sql .= " WHERE fk_pcg_version = '" . $db->escape($accountsystem->ref) . "'";
|
||||||
$sql .= ' AND entity in ('.getEntity('accounting_account', 0).')'; // Always limit to current entity. No sharing in accountancy.
|
$sql .= ' AND entity in ('.getEntity('accounting_account', 0).')'; // Always limit to current entity. No sharing in accountancy.
|
||||||
$sql .= ' LIMIT 50000'; // just as a sanity check
|
$sql .= ' LIMIT 50000'; // just as a sanity check
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|||||||
@ -198,7 +198,7 @@ if ($action == 'update') {
|
|||||||
$sql .= " WHERE rowid = ".((int) $productid);
|
$sql .= " WHERE rowid = ".((int) $productid);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog("/accountancy/admin/productaccount.php sql=".$sql, LOG_DEBUG);
|
dol_syslog("/accountancy/admin/productaccount.php", LOG_DEBUG);
|
||||||
if ($db->query($sql)) {
|
if ($db->query($sql)) {
|
||||||
$ok++;
|
$ok++;
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -329,7 +329,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
dol_syslog("/accountancy/admin/productaccount.php:: sql=".$sql, LOG_DEBUG);
|
dol_syslog("/accountancy/admin/productaccount.php", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|||||||
@ -530,25 +530,25 @@ $sqlwhere = array();
|
|||||||
if (count($filter) > 0) {
|
if (count($filter) > 0) {
|
||||||
foreach ($filter as $key => $value) {
|
foreach ($filter as $key => $value) {
|
||||||
if ($key == 't.doc_date') {
|
if ($key == 't.doc_date') {
|
||||||
$sqlwhere[] = $key.'=\''.$db->idate($value).'\'';
|
$sqlwhere[] = $key."='".$db->idate($value)."'";
|
||||||
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
||||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
$sqlwhere[] = $key."'".$db->idate($value)."'";
|
||||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=') {
|
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=') {
|
||||||
$sqlwhere[] = $key.'\''.$db->escape($value).'\'';
|
$sqlwhere[] = $key."'".$db->escape($value)."'";
|
||||||
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||||
$sqlwhere[] = $key.'='.$value;
|
$sqlwhere[] = $key.'='.((int) $value);
|
||||||
} elseif ($key == 't.numero_compte') {
|
} elseif ($key == 't.numero_compte') {
|
||||||
$sqlwhere[] = $key.' LIKE \''.$db->escape($value).'%\'';
|
$sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
|
||||||
} elseif ($key == 't.subledger_account') {
|
} elseif ($key == 't.subledger_account') {
|
||||||
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||||
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
$sqlwhere[] = $key."'".$db->idate($value)."'";
|
||||||
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
||||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
$sqlwhere[] = $key."'".$db->idate($value)."'";
|
||||||
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
|
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
|
||||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
$sqlwhere[] = $key."'".$db->idate($value)."'";
|
||||||
} elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') {
|
} elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') {
|
||||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
$sqlwhere[] = $key."'".$db->idate($value)."'";
|
||||||
} elseif ($key == 't.credit' || $key == 't.debit') {
|
} elseif ($key == 't.credit' || $key == 't.debit') {
|
||||||
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||||
} elseif ($key == 't.reconciled_option') {
|
} elseif ($key == 't.reconciled_option') {
|
||||||
@ -612,7 +612,7 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
|
|||||||
}
|
}
|
||||||
$sql .= " WHERE rowid = ".((int) $movement->id);
|
$sql .= " WHERE rowid = ".((int) $movement->id);
|
||||||
|
|
||||||
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
|
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -433,7 +433,7 @@ class AccountancyCategory // extends CommonObject
|
|||||||
|
|
||||||
$this->lines_display = array();
|
$this->lines_display = array();
|
||||||
|
|
||||||
dol_syslog(__METHOD__." sql=".$sql, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
@ -632,7 +632,7 @@ class AccountancyCategory // extends CommonObject
|
|||||||
$sql .= " WHERE aa.rowid = ".((int) $cpt_id);
|
$sql .= " WHERE aa.rowid = ".((int) $cpt_id);
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(__METHOD__." sql=".$sql, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class AccountancySystem
|
|||||||
$sql .= " a.pcg_version = '".$this->db->escape($ref)."'";
|
$sql .= " a.pcg_version = '".$this->db->escape($ref)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
@ -143,9 +143,9 @@ class AccountancySystem
|
|||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_system";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_system";
|
||||||
$sql .= " (date_creation, fk_user_author, numero, label)";
|
$sql .= " (date_creation, fk_user_author, numero, label)";
|
||||||
$sql .= " VALUES ('".$this->db->idate($now)."',".$user->id.",'".$this->db->escape($this->numero)."','".$this->db->escape($this->label)."')";
|
$sql .= " VALUES ('".$this->db->idate($now)."',".((int) $user->id).",'".$this->db->escape($this->numero)."','".$this->db->escape($this->label)."')";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_system");
|
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_system");
|
||||||
|
|||||||
@ -150,7 +150,7 @@ class AccountingAccount extends CommonObject
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->next_prev_filter = 'fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')'; // Used to add a filter in Form::showrefnav method
|
$this->next_prev_filter = "fk_pcg_version IN (SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid=".((int) $conf->global->CHARTOFACCOUNTS).")"; // Used to add a filter in Form::showrefnav method
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,7 +185,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
|
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
@ -289,7 +289,7 @@ class AccountingAccount extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -352,7 +352,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= " , reconcilable = ".(int) $this->reconcilable;
|
$sql .= " , reconcilable = ".(int) $this->reconcilable;
|
||||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -379,7 +379,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= " (SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facture_fourn_det";
|
$sql .= " (SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||||
$sql .= " WHERE fk_code_ventilation=".((int) $this->id).")";
|
$sql .= " WHERE fk_code_ventilation=".((int) $this->id).")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::checkUsage sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::checkUsage", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -604,7 +604,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= "SET ".$fieldtouse." = '0'";
|
$sql .= "SET ".$fieldtouse." = '0'";
|
||||||
$sql .= " WHERE rowid = ".((int) $id);
|
$sql .= " WHERE rowid = ".((int) $id);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::accountDeactivate ".$fieldtouse." sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::accountDeactivate ".$fieldtouse, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@ -642,7 +642,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= " SET ".$fieldtouse." = '1'";
|
$sql .= " SET ".$fieldtouse." = '1'";
|
||||||
$sql .= " WHERE rowid = ".((int) $id);
|
$sql .= " WHERE rowid = ".((int) $id);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::account_activate ".$fieldtouse." sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::account_activate ".$fieldtouse, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
@ -113,7 +113,7 @@ class AccountingJournal extends CommonObject
|
|||||||
$sql .= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
@ -170,18 +170,18 @@ class AccountingJournal extends CommonObject
|
|||||||
$sql .= ' WHERE 1 = 1';
|
$sql .= ' WHERE 1 = 1';
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($sortfield)) {
|
if (!empty($sortfield)) {
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit + 1, $offset);
|
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
|
|||||||
@ -647,7 +647,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' '.(!isset($this->credit) ? 'NULL' : $this->credit).',';
|
$sql .= ' '.(!isset($this->credit) ? 'NULL' : $this->credit).',';
|
||||||
$sql .= ' '.(!isset($this->montant) ? 'NULL' : $this->montant).',';
|
$sql .= ' '.(!isset($this->montant) ? 'NULL' : $this->montant).',';
|
||||||
$sql .= ' '.(!isset($this->sens) ? 'NULL' : "'".$this->db->escape($this->sens)."'").',';
|
$sql .= ' '.(!isset($this->sens) ? 'NULL' : "'".$this->db->escape($this->sens)."'").',';
|
||||||
$sql .= ' '.$user->id.',';
|
$sql .= ' '.((int) $user->id).',';
|
||||||
$sql .= ' '."'".$this->db->idate($now)."',";
|
$sql .= ' '."'".$this->db->idate($now)."',";
|
||||||
$sql .= ' '.(empty($this->code_journal) ? 'NULL' : "'".$this->db->escape($this->code_journal)."'").',';
|
$sql .= ' '.(empty($this->code_journal) ? 'NULL' : "'".$this->db->escape($this->code_journal)."'").',';
|
||||||
$sql .= ' '.(empty($this->journal_label) ? 'NULL' : "'".$this->db->escape($this->journal_label)."'").',';
|
$sql .= ' '.(empty($this->journal_label) ? 'NULL' : "'".$this->db->escape($this->journal_label)."'").',';
|
||||||
@ -883,7 +883,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' WHERE 1 = 1';
|
$sql .= ' WHERE 1 = 1';
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
|
||||||
}
|
}
|
||||||
// Affichage par compte comptable
|
// Affichage par compte comptable
|
||||||
if (!empty($option)) {
|
if (!empty($option)) {
|
||||||
@ -894,10 +894,10 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($sortfield)) {
|
if (!empty($sortfield)) {
|
||||||
$sql .= ', '.$sortfield.' '.$sortorder;
|
$sql .= ", ".$sortfield." ".$sortorder;
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit + 1, $offset);
|
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -1043,13 +1043,13 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND t.date_export IS NULL";
|
$sql .= " AND t.date_export IS NULL";
|
||||||
}
|
}
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
$sql .= ' AND '.implode(" ".$filtermode." ", $sqlwhere);
|
||||||
}
|
}
|
||||||
if (!empty($sortfield)) {
|
if (!empty($sortfield)) {
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit + 1, $offset);
|
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
|
|
||||||
@ -1161,7 +1161,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
$sql .= ' WHERE entity IN ('.getEntity('accountancy').')';
|
$sql .= ' WHERE entity IN ('.getEntity('accountancy').')';
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= ' GROUP BY t.numero_compte';
|
$sql .= ' GROUP BY t.numero_compte';
|
||||||
@ -1170,7 +1170,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit + 1, $offset);
|
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -1347,8 +1347,9 @@ class BookKeeping extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||||
$sql .= ' SET '.$field.'='.(is_numeric($value) ? $value : "'".$this->db->escape($value)."'");
|
$sql .= " SET ".$field." = ".(is_numeric($value) ? ((float) $value) : "'".$this->db->escape($value)."'");
|
||||||
$sql .= " WHERE piece_num = ".((int) $piece_num);
|
$sql .= " WHERE piece_num = ".((int) $piece_num);
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
@ -1678,7 +1679,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
$sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||||
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
|
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."getNextNumMvt sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."getNextNumMvt", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@ -1858,7 +1859,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' SELECT doc_date, doc_type,';
|
$sql .= ' SELECT doc_date, doc_type,';
|
||||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.", '".$this->db->idate($now)."'";
|
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
@ -2017,7 +2018,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
|
$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
|
||||||
$sql .= " AND aa.entity IN (".getEntity('accountancy').")";
|
$sql .= " AND aa.entity IN (".getEntity('accountancy').")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$obj = '';
|
$obj = '';
|
||||||
@ -2057,7 +2058,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
|
||||||
$sql .= " WHERE aa.entity IN (".getEntity('accountancy').")";
|
$sql .= " WHERE aa.entity IN (".getEntity('accountancy').")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$obj = '';
|
$obj = '';
|
||||||
|
|||||||
@ -279,7 +279,7 @@ class Lettering extends BookKeeping
|
|||||||
$sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND date_validated IS NULL ";
|
$sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND date_validated IS NULL ";
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -95,7 +95,7 @@ if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting-
|
|||||||
$sql .= " AND doc_date >= '" . $db->idate($date_start) . "'";
|
$sql .= " AND doc_date >= '" . $db->idate($date_start) . "'";
|
||||||
$sql .= " AND doc_date <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND doc_date <= '" . $db->idate($date_end) . "'";
|
||||||
|
|
||||||
dol_syslog("/accountancy/closure/index.php :: Function validate_movement_confirm Specify movements as validated sql=".$sql, LOG_DEBUG);
|
dol_syslog("/accountancy/closure/index.php :: Function validate_movement_confirm Specify movements as validated", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -189,7 +189,7 @@ for ($i = 1; $i <= 12; $i++) {
|
|||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(b.doc_date)='.$j, '1', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= " SUM(".$db->ifsql("MONTH(b.doc_date)=".$j, "1", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||||
}
|
}
|
||||||
$sql .= " COUNT(b.rowid) as total";
|
$sql .= " COUNT(b.rowid) as total";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
|
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
|
||||||
@ -198,7 +198,7 @@ $sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'";
|
|||||||
$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
|
$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
|
||||||
$sql .= " AND date_validated IS NULL";
|
$sql .= " AND date_validated IS NULL";
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/closure/index.php sql='.$sql, LOG_DEBUG);
|
dol_syslog('htdocs/accountancy/closure/index.php', LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|||||||
@ -117,7 +117,7 @@ if (!empty($id)) {
|
|||||||
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = ".((int) $id);
|
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = ".((int) $id);
|
||||||
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
|
||||||
|
|
||||||
dol_syslog("/accounting/customer/card.php sql=".$sql, LOG_DEBUG);
|
dol_syslog("/accounting/customer/card.php", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|||||||
@ -85,8 +85,8 @@ if ($action == 'clean' || $action == 'validatehistory') {
|
|||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
$sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
|
$sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
|
||||||
$sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
|
$sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
|
||||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.$conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity.')';
|
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity).')';
|
||||||
$sql1 .= ' AND fd.fk_facture IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture WHERE entity = '.$conf->entity.')';
|
$sql1 .= ' AND fd.fk_facture IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture WHERE entity = '.((int) $conf->entity).')';
|
||||||
$sql1 .= ' AND fk_code_ventilation <> 0';
|
$sql1 .= ' AND fk_code_ventilation <> 0';
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||||
@ -110,13 +110,13 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||||
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||||
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
|
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
|
||||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||||
$sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
|
$sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
|
||||||
} else {
|
} else {
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||||
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
|
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
|
||||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||||
}*/
|
}*/
|
||||||
@ -283,7 +283,7 @@ for ($i = 1; $i <= 12; $i++) {
|
|||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(f.datef)='.$j, 'fd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, "fd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(fd.total_ht) as total";
|
$sql .= " SUM(fd.total_ht) as total";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||||
@ -306,7 +306,7 @@ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
}
|
}
|
||||||
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/customer/index.php sql='.$sql, LOG_DEBUG);
|
dol_syslog('htdocs/accountancy/customer/index.php', LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
@ -367,7 +367,7 @@ for ($i = 1; $i <= 12; $i++) {
|
|||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(f.datef)='.$j, 'fd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, "fd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(fd.total_ht) as total";
|
$sql .= " SUM(fd.total_ht) as total";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||||
@ -452,7 +452,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
|||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(f.datef)='.$j, 'fd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, "fd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(fd.total_ht) as total";
|
$sql .= " SUM(fd.total_ht) as total";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||||
@ -513,7 +513,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
|||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(f.datef)='.$j, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, "(fd.total_ht-(fd.qty * fd.buy_price_ht))", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||||
|
|||||||
@ -188,7 +188,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
$accountventilated = new AccountingAccount($db);
|
$accountventilated = new AccountingAccount($db);
|
||||||
$accountventilated->fetch($monCompte, '', 1);
|
$accountventilated->fetch($monCompte, '', 1);
|
||||||
|
|
||||||
dol_syslog("accountancy/customer/list.php sql=".$sql, LOG_DEBUG);
|
dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
|
||||||
if ($db->query($sql)) {
|
if ($db->query($sql)) {
|
||||||
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||||
$ok++;
|
$ok++;
|
||||||
|
|||||||
@ -110,7 +110,7 @@ if (!empty($id)) {
|
|||||||
$sql .= " WHERE er.fk_statut > 0 AND erd.rowid = ".((int) $id);
|
$sql .= " WHERE er.fk_statut > 0 AND erd.rowid = ".((int) $id);
|
||||||
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
|
||||||
|
|
||||||
dol_syslog("/accounting/expensereport/card.php sql=".$sql, LOG_DEBUG);
|
dol_syslog("/accounting/expensereport/card.php", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|||||||
@ -79,8 +79,8 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
|
|||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
$sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
|
$sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
|
||||||
$sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
|
$sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
|
||||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.$conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity.')';
|
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity).')';
|
||||||
$sql1 .= ' AND erd.fk_expensereport IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'expensereport WHERE entity = '.$conf->entity.')';
|
$sql1 .= ' AND erd.fk_expensereport IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'expensereport WHERE entity = '.((int) $conf->entity).')';
|
||||||
$sql1 .= ' AND fk_code_ventilation <> 0';
|
$sql1 .= ' AND fk_code_ventilation <> 0';
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
@ -103,13 +103,13 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det";
|
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det";
|
||||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||||
$sql1 .= " FROM ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
|
$sql1 .= " FROM ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
|
||||||
$sql1 .= " WHERE ".MAIN_DB_PREFIX."expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
|
$sql1 .= " WHERE ".MAIN_DB_PREFIX."expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
|
||||||
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code = accnt.account_number";
|
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code = accnt.account_number";
|
||||||
$sql1 .= " AND ".MAIN_DB_PREFIX."expensereport_det.fk_code_ventilation = 0";
|
$sql1 .= " AND ".MAIN_DB_PREFIX."expensereport_det.fk_code_ventilation = 0";
|
||||||
} else {
|
} else {
|
||||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd, ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
|
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd, ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
|
||||||
$sql1 .= " SET erd.fk_code_ventilation = accnt.rowid";
|
$sql1 .= " SET erd.fk_code_ventilation = accnt.rowid";
|
||||||
$sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
|
$sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
|
||||||
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code=accnt.account_number";
|
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code=accnt.account_number";
|
||||||
$sql1 .= " AND erd.fk_code_ventilation = 0";
|
$sql1 .= " AND erd.fk_code_ventilation = 0";
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ for ($i = 1; $i <= 12; $i++) {
|
|||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(er.date_debut)='.$j, 'erd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= " SUM(".$db->ifsql("MONTH(er.date_debut)=".$j, "erd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(erd.total_ht) as total";
|
$sql .= " SUM(erd.total_ht) as total";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||||
@ -251,7 +251,7 @@ for ($i = 1; $i <= 12; $i++) {
|
|||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(er.date_debut)='.$j, 'erd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= " SUM(".$db->ifsql("MONTH(er.date_debut)=".$j, "erd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||||
}
|
}
|
||||||
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
|
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||||
@ -330,7 +330,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
|||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(er.date_create)='.$j, 'erd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= " SUM(".$db->ifsql("MONTH(er.date_create)=".$j, "erd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(erd.total_ht) as total";
|
$sql .= " SUM(erd.total_ht) as total";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||||
|
|||||||
@ -159,7 +159,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
$accountventilated = new AccountingAccount($db);
|
$accountventilated = new AccountingAccount($db);
|
||||||
$accountventilated->fetch($monCompte, '', 1);
|
$accountventilated->fetch($monCompte, '', 1);
|
||||||
|
|
||||||
dol_syslog('accountancy/expensereport/list.php:: sql='.$sql, LOG_DEBUG);
|
dol_syslog('accountancy/expensereport/list.php', LOG_DEBUG);
|
||||||
if ($db->query($sql)) {
|
if ($db->query($sql)) {
|
||||||
$msg .= '<div><span style="color:green">'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
$msg .= '<div><span style="color:green">'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||||
$ok++;
|
$ok++;
|
||||||
|
|||||||
@ -118,7 +118,7 @@ if (!empty($id)) {
|
|||||||
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = ".((int) $id);
|
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = ".((int) $id);
|
||||||
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||||
|
|
||||||
dol_syslog("/accounting/supplier/card.php sql=".$sql, LOG_DEBUG);
|
dol_syslog("/accounting/supplier/card.php", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|||||||
@ -283,7 +283,7 @@ for ($i = 1; $i <= 12; $i++) {
|
|||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(ff.datef)='.$j, 'ffd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= " SUM(".$db->ifsql("MONTH(ff.datef)=".$j, "ffd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(ffd.total_ht) as total";
|
$sql .= " SUM(ffd.total_ht) as total";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
|
||||||
@ -362,7 +362,7 @@ for ($i = 1; $i <= 12; $i++) {
|
|||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(ff.datef)='.$j, 'ffd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= " SUM(".$db->ifsql("MONTH(ff.datef)=".$j, "ffd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(ffd.total_ht) as total";
|
$sql .= " SUM(ffd.total_ht) as total";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
|
||||||
@ -441,7 +441,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
|||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(ff.datef)='.$j, 'ffd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= " SUM(".$db->ifsql("MONTH(ff.datef)=".$j, "ffd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(ffd.total_ht) as total";
|
$sql .= " SUM(ffd.total_ht) as total";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
|
||||||
|
|||||||
@ -193,7 +193,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
$accountventilated = new AccountingAccount($db);
|
$accountventilated = new AccountingAccount($db);
|
||||||
$accountventilated->fetch($monCompte, '', 1);
|
$accountventilated->fetch($monCompte, '', 1);
|
||||||
|
|
||||||
dol_syslog('accountancy/supplier/list.php sql='.$sql, LOG_DEBUG);
|
dol_syslog('accountancy/supplier/list.php', LOG_DEBUG);
|
||||||
if ($db->query($sql)) {
|
if ($db->query($sql)) {
|
||||||
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||||
$ok++;
|
$ok++;
|
||||||
|
|||||||
@ -73,7 +73,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
||||||
|
|||||||
@ -1831,8 +1831,8 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
if (!$error && !empty($bank_line_id)) {
|
if (!$error && !empty($bank_line_id)) {
|
||||||
// Update fk_bank into subscription table
|
// Update fk_bank into subscription table
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'subscription SET fk_bank='.$bank_line_id;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'subscription SET fk_bank='.((int) $bank_line_id);
|
||||||
$sql .= ' WHERE rowid='.$subscriptionid;
|
$sql .= ' WHERE rowid='.((int) $subscriptionid);
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
|
|||||||
@ -584,7 +584,7 @@ class AdherentType extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Return array of Member objects for member type this->id (or all if this->id not defined)
|
* Return array of Member objects for member type this->id (or all if this->id not defined)
|
||||||
*
|
*
|
||||||
* @param string $excludefilter Filter to exclude
|
* @param string $excludefilter Filter to exclude. This value must not come from a user input.
|
||||||
* @param int $mode 0=Return array of member instance
|
* @param int $mode 0=Return array of member instance
|
||||||
* 1=Return array of member instance without extra data
|
* 1=Return array of member instance without extra data
|
||||||
* 2=Return array of members id only
|
* 2=Return array of members id only
|
||||||
|
|||||||
@ -323,7 +323,7 @@ $sql .= " state.code_departement as state_code, state.nom as state_name,";
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -208,12 +208,12 @@ $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("EmailCollector")
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
$sql = 'SELECT ';
|
$sql = 'SELECT ';
|
||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
$sql .= 't.'.$key.', ';
|
$sql .= "t.".$key.", ";
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
@ -259,7 +259,7 @@ $sql .= $hookmanager->resPrint;
|
|||||||
$sql.= " GROUP BY ";
|
$sql.= " GROUP BY ";
|
||||||
foreach ($object->fields as $key => $val)
|
foreach ($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
$sql.='t.'.$key.', ';
|
$sql .= "t.".$key.", ";
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
|
|||||||
@ -108,9 +108,9 @@ $aCurrencies = array($conf->currency); // Default currency always first position
|
|||||||
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
|
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php';
|
||||||
|
|
||||||
$sql = 'SELECT rowid, code FROM '.MAIN_DB_PREFIX.'multicurrency';
|
$sql = "SELECT rowid, code FROM ".MAIN_DB_PREFIX."multicurrency";
|
||||||
$sql .= ' WHERE entity = '.$conf->entity;
|
$sql .= " WHERE entity = ".((int) $conf->entity);
|
||||||
$sql .= ' AND code != "'.$conf->currency.'"'; // Default currency always first position
|
$sql .= " AND code <> '".$db->escape($conf->currency)."'"; // Default currency always first position
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
|
|||||||
@ -226,12 +226,12 @@ print "<br>\n";
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
$sql = 'SELECT ';
|
$sql = 'SELECT ';
|
||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
$sql .= 't.'.$key.', ';
|
$sql .= "t.".$key.", ";
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
@ -282,7 +282,7 @@ $sql .= $hookmanager->resPrint;
|
|||||||
$sql.= " GROUP BY "
|
$sql.= " GROUP BY "
|
||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
$sql.='t.'.$key.', ';
|
$sql .= "t.".$key.", ";
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
|
|||||||
@ -146,7 +146,7 @@ if ($action == 'add') {
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue, entity) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."', ".$db->escape($conf->entity).")";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue, entity) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."', ".((int) $conf->entity).")";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|||||||
@ -327,7 +327,7 @@ class DolibarrApi
|
|||||||
* Function to forge a SQL criteria
|
* Function to forge a SQL criteria
|
||||||
*
|
*
|
||||||
* @param array $matches Array of found string by regex search.
|
* @param array $matches Array of found string by regex search.
|
||||||
* Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.date_creation:<:'2016-01-01 12:30:00'" or "t.nature:is:NULL"
|
* Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.date_creation:<:'2016-01-01 12:30:00'" or "t.nature:is:NULL" or "t.nature:isnot:NULL"
|
||||||
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
||||||
*/
|
*/
|
||||||
protected static function _forge_criteria_callback($matches)
|
protected static function _forge_criteria_callback($matches)
|
||||||
@ -345,18 +345,36 @@ class DolibarrApi
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sanitize operand
|
||||||
$operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0]));
|
$operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0]));
|
||||||
|
|
||||||
|
// Sanitize operator
|
||||||
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
|
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
|
||||||
|
// Only some operators are allowed.
|
||||||
|
if (! in_array($operator, array('LIKE', 'ULIKE', '<', '>', '<=', '>=', '=', '<>', 'IS', 'ISNOT', 'IN'))) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if ($operator == 'ISNOT') {
|
||||||
|
$operator = 'IS NOT';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sanitize value
|
||||||
$tmpescaped = trim($tmp[2]);
|
$tmpescaped = trim($tmp[2]);
|
||||||
$regbis = array();
|
$regbis = array();
|
||||||
if ($operator == 'IN') {
|
if ($operator == 'IN') {
|
||||||
$tmpescaped = "(".$db->sanitize($tmpescaped, 1).")";
|
$tmpescaped = "(".$db->sanitize($tmpescaped, 1).")";
|
||||||
} elseif (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
|
} elseif (in_array($operator, array('<', '>', '<=', '>=', '=', '<>'))) {
|
||||||
|
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) { // If 'YYYY-MM-DD HH:MM:SS+X'
|
||||||
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
||||||
} else {
|
} else {
|
||||||
$tmpescaped = $db->sanitize($db->escape($tmpescaped));
|
$tmpescaped = ((float) $tmpescaped);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
|
||||||
|
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
||||||
|
} else {
|
||||||
|
$tmpescaped = "'".$db->escape($tmpescaped)."'";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $db->escape($operand).' '.$db->escape($operator)." ".$tmpescaped;
|
return $db->escape($operand).' '.$db->escape($operator)." ".$tmpescaped;
|
||||||
|
|||||||
@ -197,12 +197,12 @@ $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Assets"));
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
$sql = 'SELECT ';
|
$sql = 'SELECT ';
|
||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
$sql .= 't.'.$key.', ';
|
$sql .= "t.".$key.", ";
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
@ -249,7 +249,7 @@ $sql .= $hookmanager->resPrint;
|
|||||||
$sql.= " GROUP BY "
|
$sql.= " GROUP BY "
|
||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
$sql.='t.'.$key.', ';
|
$sql .= "t.".$key.", ";
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
|
|||||||
@ -297,7 +297,7 @@ $sql .= $object->getFieldList('t');
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.' ' : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.' ' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
@ -363,7 +363,7 @@ $sql .= $hookmanager->resPrint;
|
|||||||
$sql.= " GROUP BY ";
|
$sql.= " GROUP BY ";
|
||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
$sql.='t.'.$key.', ';
|
$sql .= "t.".$key.", ";
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
|
|||||||
@ -431,25 +431,25 @@ class BOM extends CommonObject
|
|||||||
if (count($filter) > 0) {
|
if (count($filter) > 0) {
|
||||||
foreach ($filter as $key => $value) {
|
foreach ($filter as $key => $value) {
|
||||||
if ($key == 't.rowid') {
|
if ($key == 't.rowid') {
|
||||||
$sqlwhere[] = $key.'='.$value;
|
$sqlwhere[] = $key." = ".((int) $value);
|
||||||
} elseif (strpos($key, 'date') !== false) {
|
} elseif (strpos($key, 'date') !== false) {
|
||||||
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
|
||||||
} elseif ($key == 'customsql') {
|
} elseif ($key == 'customsql') {
|
||||||
$sqlwhere[] = $value;
|
$sqlwhere[] = $value;
|
||||||
} else {
|
} else {
|
||||||
$sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
|
$sql .= " AND (".implode(" ".$filtermode." ", $sqlwhere).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($sortfield)) {
|
if (!empty($sortfield)) {
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -1288,13 +1288,13 @@ class BOMLine extends CommonObjectLine
|
|||||||
if (count($filter) > 0) {
|
if (count($filter) > 0) {
|
||||||
foreach ($filter as $key => $value) {
|
foreach ($filter as $key => $value) {
|
||||||
if ($key == 't.rowid') {
|
if ($key == 't.rowid') {
|
||||||
$sqlwhere[] = $key.'='.$value;
|
$sqlwhere[] = $key." = ".((int) $value);
|
||||||
} elseif (strpos($key, 'date') !== false) {
|
} elseif (strpos($key, 'date') !== false) {
|
||||||
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
|
||||||
} elseif ($key == 'customsql') {
|
} elseif ($key == 'customsql') {
|
||||||
$sqlwhere[] = $value;
|
$sqlwhere[] = $value;
|
||||||
} else {
|
} else {
|
||||||
$sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1306,7 +1306,7 @@ class BOMLine extends CommonObjectLine
|
|||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -455,7 +455,7 @@ class Categorie extends CommonObject
|
|||||||
$sql .= ($this->socid > 0 ? $this->socid : 'null').", ";
|
$sql .= ($this->socid > 0 ? $this->socid : 'null').", ";
|
||||||
}
|
}
|
||||||
$sql .= "'".$this->db->escape($this->visible)."', ";
|
$sql .= "'".$this->db->escape($this->visible)."', ";
|
||||||
$sql .= $this->db->escape($type).", ";
|
$sql .= ((int) $type).", ";
|
||||||
$sql .= (!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : 'null').", ";
|
$sql .= (!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : 'null').", ";
|
||||||
$sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : 'null').", ";
|
$sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : 'null').", ";
|
||||||
$sql .= (int) $conf->entity.", ";
|
$sql .= (int) $conf->entity.", ";
|
||||||
@ -687,7 +687,7 @@ class Categorie extends CommonObject
|
|||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type]);
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type]);
|
||||||
$sql .= " (fk_categorie, fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type]).")";
|
$sql .= " (fk_categorie, fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type]).")";
|
||||||
$sql .= " VALUES (".$this->id.", ".$obj->id.")";
|
$sql .= " VALUES (".((int) $this->id).", ".((int) $obj->id).")";
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::add_type', LOG_DEBUG);
|
dol_syslog(get_class($this).'::add_type', LOG_DEBUG);
|
||||||
if ($this->db->query($sql)) {
|
if ($this->db->query($sql)) {
|
||||||
@ -924,12 +924,11 @@ class Categorie extends CommonObject
|
|||||||
$idoftype = array_search($type, self::$MAP_ID_TO_CODE);
|
$idoftype = array_search($type, self::$MAP_ID_TO_CODE);
|
||||||
|
|
||||||
$sql = "SELECT s.rowid";
|
$sql = "SELECT s.rowid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as s, ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub";
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
|
|
||||||
$sql .= ' WHERE s.entity IN ('.getEntity('category').')';
|
$sql .= ' WHERE s.entity IN ('.getEntity('category').')';
|
||||||
$sql .= ' AND s.type='.((int) $idoftype);
|
$sql .= ' AND s.type='.((int) $idoftype);
|
||||||
$sql .= ' AND s.rowid = sub.fk_categorie';
|
$sql .= ' AND s.rowid = sub.fk_categorie';
|
||||||
$sql .= ' AND sub.'.$subcol_name.' = '.((int) $id);
|
$sql .= " AND sub.".$subcol_name." = ".((int) $id);
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
@ -1816,8 +1815,8 @@ class Categorie extends CommonObject
|
|||||||
$sql2 .= " WHERE fk_category = ".((int) $this->id)." AND lang = '".$this->db->escape($key)."'";
|
$sql2 .= " WHERE fk_category = ".((int) $this->id)." AND lang = '".$this->db->escape($key)."'";
|
||||||
} else {
|
} else {
|
||||||
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)";
|
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)";
|
||||||
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->label);
|
$sql2 .= " VALUES(".((int) $this->id).", '".$this->db->escape($key)."', '".$this->db->escape($this->label)."'";
|
||||||
$sql2 .= "','".$this->db->escape($this->multilangs["$key"]["description"])."')";
|
$sql2 .= ", '".$this->db->escape($this->multilangs["$key"]["description"])."')";
|
||||||
}
|
}
|
||||||
dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG);
|
dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG);
|
||||||
if (!$this->db->query($sql2)) {
|
if (!$this->db->query($sql2)) {
|
||||||
@ -1832,8 +1831,8 @@ class Categorie extends CommonObject
|
|||||||
$sql2 .= " WHERE fk_category=".((int) $this->id)." AND lang='".$this->db->escape($key)."'";
|
$sql2 .= " WHERE fk_category=".((int) $this->id)." AND lang='".$this->db->escape($key)."'";
|
||||||
} else {
|
} else {
|
||||||
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)";
|
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)";
|
||||||
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->multilangs["$key"]["label"]);
|
$sql2 .= " VALUES(".((int) $this->id).", '".$this->db->escape($key)."', '".$this->db->escape($this->multilangs["$key"]["label"])."'";
|
||||||
$sql2 .= "','".$this->db->escape($this->multilangs["$key"]["description"])."')";
|
$sql2 .= ",'".$this->db->escape($this->multilangs["$key"]["description"])."')";
|
||||||
}
|
}
|
||||||
|
|
||||||
// on ne sauvegarde pas des champs vides
|
// on ne sauvegarde pas des champs vides
|
||||||
|
|||||||
@ -542,18 +542,18 @@ class ActionComm extends CommonObject
|
|||||||
$sql .= (isset($this->type_id) ? $this->type_id : "null").",";
|
$sql .= (isset($this->type_id) ? $this->type_id : "null").",";
|
||||||
$sql .= ($code ? ("'".$this->db->escape($code)."'") : "null").", ";
|
$sql .= ($code ? ("'".$this->db->escape($code)."'") : "null").", ";
|
||||||
$sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").", ";
|
$sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").", ";
|
||||||
$sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", ";
|
$sql .= ((isset($this->socid) && $this->socid > 0) ? ((int) $this->socid) : "null").", ";
|
||||||
$sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", ";
|
$sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? ((int) $this->fk_project) : "null").", ";
|
||||||
$sql .= " '".$this->db->escape($this->note_private)."', ";
|
$sql .= " '".$this->db->escape($this->note_private)."', ";
|
||||||
$sql .= ((isset($this->contact_id) && $this->contact_id > 0) ? $this->contact_id : "null").", "; // deprecated, use ->socpeopleassigned
|
$sql .= ((isset($this->contact_id) && $this->contact_id > 0) ? ((int) $this->contact_id) : "null").", "; // deprecated, use ->socpeopleassigned
|
||||||
$sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", ";
|
$sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", ";
|
||||||
$sql .= ($userownerid > 0 ? $userownerid : "null").", ";
|
$sql .= ($userownerid > 0 ? $userownerid : "null").", ";
|
||||||
$sql .= ($userdoneid > 0 ? $userdoneid : "null").", ";
|
$sql .= ($userdoneid > 0 ? $userdoneid : "null").", ";
|
||||||
$sql .= "'".$this->db->escape($this->label)."','".$this->db->escape($this->percentage)."','".$this->db->escape($this->priority)."','".$this->db->escape($this->fulldayevent)."','".$this->db->escape($this->location)."', ";
|
$sql .= "'".$this->db->escape($this->label)."','".$this->db->escape($this->percentage)."','".$this->db->escape($this->priority)."','".$this->db->escape($this->fulldayevent)."','".$this->db->escape($this->location)."', ";
|
||||||
$sql .= "'".$this->db->escape($this->transparency)."', ";
|
$sql .= "'".$this->db->escape($this->transparency)."', ";
|
||||||
$sql .= (!empty($this->fk_element) ? $this->fk_element : "null").", ";
|
$sql .= (!empty($this->fk_element) ? ((int) $this->fk_element) : "null").", ";
|
||||||
$sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", ";
|
$sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", ";
|
||||||
$sql .= $conf->entity.",";
|
$sql .= ((int) $conf->entity).",";
|
||||||
$sql .= (!empty($this->extraparams) ? "'".$this->db->escape($this->extraparams)."'" : "null").", ";
|
$sql .= (!empty($this->extraparams) ? "'".$this->db->escape($this->extraparams)."'" : "null").", ";
|
||||||
// Fields emails
|
// Fields emails
|
||||||
$sql .= (!empty($this->email_msgid) ? "'".$this->db->escape($this->email_msgid)."'" : "null").", ";
|
$sql .= (!empty($this->email_msgid) ? "'".$this->db->escape($this->email_msgid)."'" : "null").", ";
|
||||||
@ -593,7 +593,7 @@ class ActionComm extends CommonObject
|
|||||||
if (!empty($already_inserted[$val['id']])) continue;
|
if (!empty($already_inserted[$val['id']])) continue;
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||||
$sql .= " VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory']) ? '0' : $val['mandatory']).", ".(empty($val['transparency']) ? '0' : $val['transparency']).", ".(empty($val['answer_status']) ? '0' : $val['answer_status']).")";
|
$sql .= " VALUES(".((int) $this->id).", 'user', ".((int) $val['id']).", ".(empty($val['mandatory']) ? '0' : ((int) $val['mandatory'])).", ".(empty($val['transparency']) ? '0' : ((int) $val['transparency'])).", ".(empty($val['answer_status']) ? '0' : ((int) $val['answer_status'])).")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
@ -615,7 +615,7 @@ class ActionComm extends CommonObject
|
|||||||
if (!empty($already_inserted[$val['id']])) continue;
|
if (!empty($already_inserted[$val['id']])) continue;
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||||
$sql .= " VALUES(".$this->id.", 'socpeople', ".$id.", 0, 0, 0)";
|
$sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $id).", 0, 0, 0)";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
@ -1170,7 +1170,7 @@ class ActionComm extends CommonObject
|
|||||||
if (!empty($already_inserted[$val['id']])) continue;
|
if (!empty($already_inserted[$val['id']])) continue;
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||||
$sql .= " VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory']) ? '0' : $val['mandatory']).", ".(empty($val['transparency']) ? '0' : $val['transparency']).", ".(empty($val['answer_status']) ? '0' : $val['answer_status']).")";
|
$sql .= " VALUES(".((int) $this->id).", 'user', ".((int) $val['id']).", ".(empty($val['mandatory']) ? '0' : ((int) $val['mandatory'])).", ".(empty($val['transparency']) ? '0' : ((int) $val['transparency'])).", ".(empty($val['answer_status']) ? '0' : ((int) $val['answer_status'])).")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
@ -1193,7 +1193,7 @@ class ActionComm extends CommonObject
|
|||||||
if (!empty($already_inserted[$val['id']])) continue;
|
if (!empty($already_inserted[$val['id']])) continue;
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||||
$sql .= " VALUES(".$this->id.", 'socpeople', ".$id.", 0, 0, 0)";
|
$sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $id).", 0, 0, 0)";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
|
|||||||
@ -878,7 +878,7 @@ if ($showbirthday) {
|
|||||||
// Add events in array
|
// Add events in array
|
||||||
$sql = 'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
|
$sql = 'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp';
|
||||||
$sql .= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.$user->id.'))';
|
$sql .= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.((int) $user->id).'))';
|
||||||
$sql .= " AND sp.entity IN (".getEntity('socpeople').")";
|
$sql .= " AND sp.entity IN (".getEntity('socpeople').")";
|
||||||
if ($action == 'show_day') {
|
if ($action == 'show_day') {
|
||||||
$sql .= ' AND MONTH(birthday) = '.((int) $month);
|
$sql .= ' AND MONTH(birthday) = '.((int) $month);
|
||||||
|
|||||||
@ -381,7 +381,7 @@ $sql .= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -181,7 +181,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||||
@ -230,7 +230,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
|
||||||
$sql .= " WHERE t.rowid = ".((int) $id);
|
$sql .= " WHERE t.rowid = ".((int) $id);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
if ($this->db->num_rows($resql)) {
|
if ($this->db->num_rows($resql)) {
|
||||||
@ -289,7 +289,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
$sql .= " WHERE t.fk_element = ".((int) $this->fk_element)." AND type_element = 'mailing'";
|
$sql .= " WHERE t.fk_element = ".((int) $this->fk_element)." AND type_element = 'mailing'";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
if ($this->db->num_rows($resql)) {
|
if ($this->db->num_rows($resql)) {
|
||||||
@ -352,7 +352,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
$sql .= " WHERE t.fk_element = ".((int) $this->fk_element)." AND type_element = '".$this->db->escape($type_element)."'";
|
$sql .= " WHERE t.fk_element = ".((int) $this->fk_element)." AND type_element = '".$this->db->escape($type_element)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
if ($this->db->num_rows($resql)) {
|
if ($this->db->num_rows($resql)) {
|
||||||
@ -422,7 +422,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
$sql .= " WHERE rowid=".((int) $this->id);
|
$sql .= " WHERE rowid=".((int) $this->id);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -600,31 +600,31 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') ||
|
if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') ||
|
||||||
($extrafields->attributes[$elementtype]['type'][$key] == 'text')) {
|
($extrafields->attributes[$elementtype]['type'][$key] == 'text')) {
|
||||||
if (!empty($arrayquery['options_'.$key])) {
|
if (!empty($arrayquery['options_'.$key])) {
|
||||||
$sqlwhere[] = " (te.".$key." LIKE '".$this->db->escape($arrayquery['options_'.$key])."')";
|
$sqlwhere[] = " (te.".$key." LIKE '".$this->db->escape($arrayquery["options_".$key])."')";
|
||||||
}
|
}
|
||||||
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') ||
|
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') ||
|
||||||
($extrafields->attributes[$elementtype]['type'][$key] == 'double')) {
|
($extrafields->attributes[$elementtype]['type'][$key] == 'double')) {
|
||||||
if (!empty($arrayquery['options_'.$key.'_max'])) {
|
if (!empty($arrayquery['options_'.$key.'_max'])) {
|
||||||
$sqlwhere[] = " (te.".$key." >= ".$arrayquery['options_'.$key.'_max']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min'].")";
|
$sqlwhere[] = " (te.".$key." >= ".((float) $arrayquery["options_".$key."_max"])." AND te.".$key." <= ".((float) $arrayquery["options_".$key.'_min']).")";
|
||||||
}
|
}
|
||||||
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') ||
|
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') ||
|
||||||
($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
|
($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
|
||||||
if (!empty($arrayquery['options_'.$key.'_end_dt'])) {
|
if (!empty($arrayquery['options_'.$key.'_end_dt'])) {
|
||||||
$sqlwhere[] = " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'])."')";
|
$sqlwhere[] = " (te.".$key." >= '".$this->db->idate($arrayquery["options_".$key."_st_dt"])."' AND te.".$key." <= '".$this->db->idate($arrayquery["options_".$key."_end_dt"])."')";
|
||||||
}
|
}
|
||||||
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') {
|
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') {
|
||||||
if ($arrayquery['options_'.$key] != '') {
|
if ($arrayquery['options_'.$key] != '') {
|
||||||
$sqlwhere[] = " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")";
|
$sqlwhere[] = " (te.".$key." = ".((int) $arrayquery["options_".$key]).")";
|
||||||
}
|
}
|
||||||
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') {
|
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') {
|
||||||
if ($arrayquery['options_'.$key] > 0) {
|
if ($arrayquery['options_'.$key] > 0) {
|
||||||
$sqlwhere[]= " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")";
|
$sqlwhere[]= " (te.".$key." = ".((int) $arrayquery["options_".$key]).")";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_array($arrayquery['options_'.$key])) {
|
if (is_array($arrayquery['options_'.$key])) {
|
||||||
$sqlwhere[] = " (te.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery['options_'.$key])."'", 1)."))";
|
$sqlwhere[] = " (te.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery["options_".$key])."'", 1)."))";
|
||||||
} elseif (!empty($arrayquery['options_'.$key])) {
|
} elseif (!empty($arrayquery['options_'.$key])) {
|
||||||
$sqlwhere[] = " (te.".$key." LIKE '".$this->db->escape($arrayquery['options_'.$key])."')";
|
$sqlwhere[] = " (te.".$key." LIKE '".$this->db->escape($arrayquery["options_".$key])."')";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -636,7 +636,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::query_thirdparty sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::query_thirdparty", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$this->thirdparty_lines = array();
|
$this->thirdparty_lines = array();
|
||||||
@ -743,31 +743,31 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') ||
|
if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') ||
|
||||||
($extrafields->attributes[$elementtype]['type'][$key] == 'text')) {
|
($extrafields->attributes[$elementtype]['type'][$key] == 'text')) {
|
||||||
if (!empty($arrayquery['options_'.$key.'_cnct'])) {
|
if (!empty($arrayquery['options_'.$key.'_cnct'])) {
|
||||||
$sqlwhere[] = " (te.".$key." LIKE '".$this->db->escape($arrayquery['options_'.$key.'_cnct'])."')";
|
$sqlwhere[] = " (te.".$key." LIKE '".$this->db->escape($arrayquery["options_".$key."_cnct"])."')";
|
||||||
}
|
}
|
||||||
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') ||
|
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') ||
|
||||||
($extrafields->attributes[$elementtype]['type'][$key] == 'double')) {
|
($extrafields->attributes[$elementtype]['type'][$key] == 'double')) {
|
||||||
if (!empty($arrayquery['options_'.$key.'_max_cnct'])) {
|
if (!empty($arrayquery['options_'.$key.'_max_cnct'])) {
|
||||||
$sqlwhere[] = " (te.".$key." >= ".$arrayquery['options_'.$key.'_max_cnct']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min_cnct'].")";
|
$sqlwhere[] = " (te.".$key." >= ".((float) $arrayquery["options_".$key."_max_cnct"])." AND te.".$key." <= ".((float) $arrayquery["options_".$key."_min_cnct"]).")";
|
||||||
}
|
}
|
||||||
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') ||
|
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') ||
|
||||||
($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
|
($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
|
||||||
if (!empty($arrayquery['options_'.$key.'_end_dt_cnct'])) {
|
if (!empty($arrayquery['options_'.$key.'_end_dt_cnct'])) {
|
||||||
$sqlwhere[] = " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt_cnct'])."')";
|
$sqlwhere[] = " (te.".$key." >= '".$this->db->idate($arrayquery["options_".$key."_st_dt_cnct"])."' AND te.".$key." <= '".$this->db->idate($arrayquery["options_".$key."_end_dt_cnct"])."')";
|
||||||
}
|
}
|
||||||
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') {
|
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') {
|
||||||
if ($arrayquery['options_'.$key.'_cnct'] != '') {
|
if ($arrayquery['options_'.$key.'_cnct'] != '') {
|
||||||
if ($arrayquery['options_'.$key.'_cnct'] == 0) {
|
if ($arrayquery['options_'.$key.'_cnct'] == 0) {
|
||||||
$sqlwhere[] = " (te.".$key." = ".$arrayquery['options_'.$key.'_cnct']." OR ((te.".$key." IS NULL) AND (te.fk_object IS NOT NULL)))";
|
$sqlwhere[] = " (te.".$key." = ".((int) $arrayquery["options_".$key."_cnct"])." OR ((te.".$key." IS NULL) AND (te.fk_object IS NOT NULL)))";
|
||||||
} else {
|
} else {
|
||||||
$sqlwhere[] = " (te.".$key." = ".$arrayquery['options_'.$key.'_cnct'].")";
|
$sqlwhere[] = " (te.".$key." = ".((int) $arrayquery["options_".$key."_cnct"]).")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_array($arrayquery['options_'.$key.'_cnct'])) {
|
if (is_array($arrayquery['options_'.$key.'_cnct'])) {
|
||||||
$sqlwhere[] = " (te.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery['options_'.$key.'_cnct'])."'", 1)."))";
|
$sqlwhere[] = " (te.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery["options_".$key."_cnct"])."'", 1)."))";
|
||||||
} elseif (!empty($arrayquery['options_'.$key.'_cnct'])) {
|
} elseif (!empty($arrayquery['options_'.$key.'_cnct'])) {
|
||||||
$sqlwhere[] = " (te.".$key." LIKE '".$this->db->escape($arrayquery['options_'.$key.'_cnct'])."')";
|
$sqlwhere[] = " (te.".$key." LIKE '".$this->db->escape($arrayquery["options_".$key."_cnct"])."')";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -850,22 +850,22 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') ||
|
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') ||
|
||||||
($extrafields->attributes[$elementtype]['type'][$key] == 'double')) {
|
($extrafields->attributes[$elementtype]['type'][$key] == 'double')) {
|
||||||
if (!empty($arrayquery['options_'.$key.'_max'])) {
|
if (!empty($arrayquery['options_'.$key.'_max'])) {
|
||||||
$sqlwhere[] = " (tse.".$key." >= ".$arrayquery['options_'.$key.'_max']." AND tse.".$key." <= ".$arrayquery['options_'.$key.'_min'].")";
|
$sqlwhere[] = " (tse.".$key." >= ".((float) $arrayquery["options_".$key."_max"])." AND tse.".$key." <= ".((float) $arrayquery["options_".$key."_min"]).")";
|
||||||
}
|
}
|
||||||
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') ||
|
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') ||
|
||||||
($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
|
($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
|
||||||
if (!empty($arrayquery['options_'.$key.'_end_dt'])) {
|
if (!empty($arrayquery['options_'.$key.'_end_dt'])) {
|
||||||
$sqlwhere[] = " (tse.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'])."' AND tse.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'])."')";
|
$sqlwhere[] = " (tse.".$key." >= '".$this->db->idate($arrayquery["options_".$key."_st_dt"])."' AND tse.".$key." <= '".$this->db->idate($arrayquery["options_".$key."_end_dt"])."')";
|
||||||
}
|
}
|
||||||
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') {
|
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') {
|
||||||
if ($arrayquery['options_'.$key] != '') {
|
if ($arrayquery['options_'.$key] != '') {
|
||||||
$sqlwhere[] = " (tse.".$key." = ".$arrayquery['options_'.$key].")";
|
$sqlwhere[] = " (tse.".$key." = ".((int) $arrayquery["options_".$key]).")";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_array($arrayquery['options_'.$key])) {
|
if (is_array($arrayquery['options_'.$key])) {
|
||||||
$sqlwhere[] = " (tse.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery['options_'.$key])."'", 1)."))";
|
$sqlwhere[] = " (tse.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery["options_".$key])."'", 1)."))";
|
||||||
} elseif (!empty($arrayquery['options_'.$key])) {
|
} elseif (!empty($arrayquery['options_'.$key])) {
|
||||||
$sqlwhere[] = " (tse.".$key." LIKE '".$this->db->escape($arrayquery['options_'.$key])."')";
|
$sqlwhere[] = " (tse.".$key." LIKE '".$this->db->escape($arrayquery["options_".$key])."')";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -877,7 +877,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::query_contact sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::query_contact", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$this->contact_lines = array();
|
$this->contact_lines = array();
|
||||||
|
|||||||
@ -244,15 +244,15 @@ class FormAdvTargetEmailing extends Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT '.$keyList.', '.$InfoFieldList [1];
|
$sql = "SELECT ".$keyList.", ".$InfoFieldList[1];
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList [0];
|
$sql .= " FROM ".MAIN_DB_PREFIX.$InfoFieldList[0];
|
||||||
if (!empty($InfoFieldList[3])) {
|
if (!empty($InfoFieldList[3])) {
|
||||||
// We have to join on extrafield table
|
// We have to join on extrafield table
|
||||||
if (strpos($InfoFieldList[3], 'extra') !== false) {
|
if (strpos($InfoFieldList[3], 'extra') !== false) {
|
||||||
$sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra';
|
$sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra';
|
||||||
$sql .= ' WHERE extra.fk_object=main.'.$InfoFieldList [2].' AND '.$InfoFieldList [3];
|
$sql .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[3];
|
||||||
} else {
|
} else {
|
||||||
$sql .= ' WHERE '.$InfoFieldList [3];
|
$sql .= " WHERE ".$InfoFieldList[3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($InfoFieldList[1])) {
|
if (!empty($InfoFieldList[1])) {
|
||||||
|
|||||||
@ -228,7 +228,7 @@ class Mailing extends CommonObject
|
|||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing";
|
||||||
$sql .= " (date_creat, fk_user_creat, entity)";
|
$sql .= " (date_creat, fk_user_creat, entity)";
|
||||||
$sql .= " VALUES ('".$this->db->idate($now)."', ".$user->id.", ".$conf->entity.")";
|
$sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $user->id).", ".((int) $conf->entity).")";
|
||||||
|
|
||||||
if (!$this->title) {
|
if (!$this->title) {
|
||||||
$this->title = $langs->trans("NoTitle");
|
$this->title = $langs->trans("NoTitle");
|
||||||
@ -647,7 +647,7 @@ class Mailing extends CommonObject
|
|||||||
$nbforupdate = $obj->nb;
|
$nbforupdate = $obj->nb;
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'mailing SET nbemail = '.((int) $nbforupdate);
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'mailing SET nbemail = '.((int) $nbforupdate);
|
||||||
$sql .= ' WHERE rowid = '.$this->id;
|
$sql .= ' WHERE rowid = '.((int) $this->id);
|
||||||
|
|
||||||
$resqlupdate = $this->db->query($sql);
|
$resqlupdate = $this->db->query($sql);
|
||||||
if (! $resqlupdate) {
|
if (! $resqlupdate) {
|
||||||
|
|||||||
@ -1727,7 +1727,7 @@ class Propal extends CommonObject
|
|||||||
$sql .= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc';
|
$sql .= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as d';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as d';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (d.fk_product = p.rowid)';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (d.fk_product = p.rowid)';
|
||||||
$sql .= ' WHERE d.fk_propal = '.$this->id;
|
$sql .= ' WHERE d.fk_propal = '.((int) $this->id);
|
||||||
if ($only_product) {
|
if ($only_product) {
|
||||||
$sql .= ' AND p.fk_product_type = 0';
|
$sql .= ' AND p.fk_product_type = 0';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -481,7 +481,7 @@ if ($search_categ_cus) {
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -934,8 +934,8 @@ class Commande extends CommonOrder
|
|||||||
$sql .= ", multicurrency_code";
|
$sql .= ", multicurrency_code";
|
||||||
$sql .= ", multicurrency_tx";
|
$sql .= ", multicurrency_tx";
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
$sql .= " VALUES ('(PROV)', ".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
|
$sql .= " VALUES ('(PROV)', ".((int) $this->socid).", '".$this->db->idate($now)."', ".((int) $user->id);
|
||||||
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null");
|
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null");
|
||||||
$sql .= ", '".$this->db->idate($date)."'";
|
$sql .= ", '".$this->db->idate($date)."'";
|
||||||
$sql .= ", ".($this->source >= 0 && $this->source != '' ? $this->db->escape($this->source) : 'null');
|
$sql .= ", ".($this->source >= 0 && $this->source != '' ? $this->db->escape($this->source) : 'null');
|
||||||
$sql .= ", '".$this->db->escape($this->note_private)."'";
|
$sql .= ", '".$this->db->escape($this->note_private)."'";
|
||||||
@ -944,15 +944,15 @@ class Commande extends CommonOrder
|
|||||||
$sql .= ", ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null");
|
$sql .= ", ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null");
|
||||||
$sql .= ", ".($this->ref_int ? "'".$this->db->escape($this->ref_int)."'" : "null");
|
$sql .= ", ".($this->ref_int ? "'".$this->db->escape($this->ref_int)."'" : "null");
|
||||||
$sql .= ", '".$this->db->escape($this->model_pdf)."'";
|
$sql .= ", '".$this->db->escape($this->model_pdf)."'";
|
||||||
$sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : "null");
|
$sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : "null");
|
||||||
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "null");
|
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "null");
|
||||||
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
|
$sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
|
||||||
$sql .= ", ".($this->availability_id > 0 ? $this->availability_id : "null");
|
$sql .= ", ".($this->availability_id > 0 ? ((int) $this->availability_id) : "null");
|
||||||
$sql .= ", ".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null");
|
$sql .= ", ".($this->demand_reason_id > 0 ? ((int) $this->demand_reason_id) : "null");
|
||||||
$sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null");
|
$sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null");
|
||||||
$sql .= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : 'NULL');
|
$sql .= ", ".($this->fk_delivery_address > 0 ? ((int) $this->fk_delivery_address) : 'NULL');
|
||||||
$sql .= ", ".(!empty($this->shipping_method_id) && $this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL');
|
$sql .= ", ".(!empty($this->shipping_method_id) && $this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : 'NULL');
|
||||||
$sql .= ", ".(!empty($this->warehouse_id) && $this->warehouse_id > 0 ? $this->warehouse_id : 'NULL');
|
$sql .= ", ".(!empty($this->warehouse_id) && $this->warehouse_id > 0 ? ((int) $this->warehouse_id) : 'NULL');
|
||||||
$sql .= ", ".($this->remise_absolue > 0 ? $this->db->escape($this->remise_absolue) : 'NULL');
|
$sql .= ", ".($this->remise_absolue > 0 ? $this->db->escape($this->remise_absolue) : 'NULL');
|
||||||
$sql .= ", ".($this->remise_percent > 0 ? $this->db->escape($this->remise_percent) : 0);
|
$sql .= ", ".($this->remise_percent > 0 ? $this->db->escape($this->remise_percent) : 0);
|
||||||
$sql .= ", ".(int) $this->fk_incoterms;
|
$sql .= ", ".(int) $this->fk_incoterms;
|
||||||
@ -962,7 +962,7 @@ class Commande extends CommonOrder
|
|||||||
$sql .= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null");
|
$sql .= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null");
|
||||||
$sql .= ", ".(int) $this->fk_multicurrency;
|
$sql .= ", ".(int) $this->fk_multicurrency;
|
||||||
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
|
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
|
||||||
$sql .= ", ".(double) $this->multicurrency_tx;
|
$sql .= ", ".(float) $this->multicurrency_tx;
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
|
|||||||
@ -436,7 +436,7 @@ if ($search_categ_cus) {
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -561,7 +561,7 @@ $sql .= " ba.rowid as bankid, ba.ref as bankref";
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -185,7 +185,7 @@ $sql = "SELECT b.rowid, b.label, b.courant, b.rappro, b.account_number, b.fk_acc
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -223,7 +223,7 @@ $sql .= $object->getFieldList('t');
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
@ -287,7 +287,7 @@ $sql .= $hookmanager->resPrint;
|
|||||||
/* If a group by is required
|
/* If a group by is required
|
||||||
$sql.= " GROUP BY ";
|
$sql.= " GROUP BY ";
|
||||||
foreach($object->fields as $key => $val) {
|
foreach($object->fields as $key => $val) {
|
||||||
$sql.='t.'.$key.', ';
|
$sql .= "t.".$key.", ";
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
|
|||||||
@ -260,7 +260,7 @@ $sql .= " f.fk_cond_reglement, f.fk_mode_reglement";
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -561,7 +561,7 @@ if ($search_categ_cus && $search_categ_cus!=-1) {
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -292,8 +292,8 @@ class Paiement extends CommonObject
|
|||||||
$note = ($this->note_private ? $this->note_private : $this->note);
|
$note = ($this->note_private ? $this->note_private : $this->note);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, ref_ext, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, pos_change)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, ref_ext, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, pos_change)";
|
||||||
$sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->escape($this->ref_ext)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", ";
|
$sql .= " VALUES (".((int) $conf->entity).", '".$this->db->escape($this->ref)."', '".$this->db->escape($this->ref_ext)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".((float) $total).", ".((float) $mtotal).", ".((int) $this->paiementid).", ";
|
||||||
$sql .= "'".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".((float) $this->pos_change).")";
|
$sql .= "'".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".((int) $user->id).", ".((float) $this->pos_change).")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -305,7 +305,7 @@ class Paiement extends CommonObject
|
|||||||
if (is_numeric($amount) && $amount <> 0) {
|
if (is_numeric($amount) && $amount <> 0) {
|
||||||
$amount = price2num($amount);
|
$amount = price2num($amount);
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiement_facture (fk_facture, fk_paiement, amount, multicurrency_amount)';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiement_facture (fk_facture, fk_paiement, amount, multicurrency_amount)';
|
||||||
$sql .= ' VALUES ('.$facid.', '.$this->id.', \''.$amount.'\', \''.$this->multicurrency_amounts[$key].'\')';
|
$sql .= ' VALUES ('.((int) $facid).', '.((int) $this->id).", ".((float) $amount).", ".((float) $this->multicurrency_amounts[$key]).')';
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::create Amount line '.$key.' insert paiement_facture', LOG_DEBUG);
|
dol_syslog(get_class($this).'::create Amount line '.$key.' insert paiement_facture', LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -868,7 +868,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= " AND f.total_ttc > 0";
|
$sql .= " AND f.total_ttc > 0";
|
||||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||||
|
|
||||||
dol_syslog(__METHOD__."::Read invoices, sql=".$sql, LOG_DEBUG);
|
dol_syslog(__METHOD__."::Read invoices,", LOG_DEBUG);
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -992,7 +992,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= " AND entity = ".((int) $conf->entity);
|
$sql .= " AND entity = ".((int) $conf->entity);
|
||||||
$sql .= " ORDER BY ref DESC LIMIT 1";
|
$sql .= " ORDER BY ref DESC LIMIT 1";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -1408,7 +1408,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
|
||||||
$sql .= " VALUES ('".$this->db->idate($now)."', ".$userid.", 'NULL', 'NULL', '".$this->db->escape($action)."')";
|
$sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $userid).", 'NULL', 'NULL', '".$this->db->escape($action)."')";
|
||||||
|
|
||||||
dol_syslog("adnotiff: ".$sql);
|
dol_syslog("adnotiff: ".$sql);
|
||||||
if ($this->db->query($sql)) {
|
if ($this->db->query($sql)) {
|
||||||
|
|||||||
@ -325,7 +325,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||||||
$sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label, cc.code ";
|
$sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label, cc.code ";
|
||||||
$sql .= " ORDER BY country, product_type, vatrate";
|
$sql .= " ORDER BY country, product_type, vatrate";
|
||||||
|
|
||||||
dol_syslog("htdocs/compta/tva/index.php sql=".$sql, LOG_DEBUG);
|
dol_syslog("htdocs/compta/tva/index.php", LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
@ -413,7 +413,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||||||
$sql2 .= " ORDER BY country, product_type, vatrate";
|
$sql2 .= " ORDER BY country, product_type, vatrate";
|
||||||
|
|
||||||
//print $sql2;
|
//print $sql2;
|
||||||
dol_syslog("htdocs/compta/tva/index.php sql=".$sql, LOG_DEBUG);
|
dol_syslog("htdocs/compta/tva/index.php", LOG_DEBUG);
|
||||||
$resql2 = $db->query($sql2);
|
$resql2 = $db->query($sql2);
|
||||||
if ($resql2) {
|
if ($resql2) {
|
||||||
$num = $db->num_rows($resql2);
|
$num = $db->num_rows($resql2);
|
||||||
|
|||||||
@ -361,7 +361,7 @@ $sql .= " co.label as country, co.code as country_code";
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -957,13 +957,13 @@ class Contrat extends CommonObject
|
|||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
|
||||||
$sql .= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
|
$sql .= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
|
||||||
$sql .= " ref, entity, note_private, note_public, ref_customer, ref_supplier, ref_ext)";
|
$sql .= " ref, entity, note_private, note_public, ref_customer, ref_supplier, ref_ext)";
|
||||||
$sql .= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id;
|
$sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $this->socid).", ".((int) $user->id);
|
||||||
$sql .= ", ".(dol_strlen($this->date_contrat) != 0 ? "'".$this->db->idate($this->date_contrat)."'" : "NULL");
|
$sql .= ", ".(dol_strlen($this->date_contrat) != 0 ? "'".$this->db->idate($this->date_contrat)."'" : "NULL");
|
||||||
$sql .= ",".($this->commercial_signature_id > 0 ? $this->commercial_signature_id : "NULL");
|
$sql .= ",".($this->commercial_signature_id > 0 ? ((int) $this->commercial_signature_id) : "NULL");
|
||||||
$sql .= ",".($this->commercial_suivi_id > 0 ? $this->commercial_suivi_id : "NULL");
|
$sql .= ",".($this->commercial_suivi_id > 0 ? ((int) $this->commercial_suivi_id) : "NULL");
|
||||||
$sql .= ",".($this->fk_project > 0 ? $this->fk_project : "NULL");
|
$sql .= ",".($this->fk_project > 0 ? ((int) $this->fk_project) : "NULL");
|
||||||
$sql .= ", ".(dol_strlen($this->ref) <= 0 ? "null" : "'".$this->db->escape($this->ref)."'");
|
$sql .= ", ".(dol_strlen($this->ref) <= 0 ? "null" : "'".$this->db->escape($this->ref)."'");
|
||||||
$sql .= ", ".$conf->entity;
|
$sql .= ", ".((int) $conf->entity);
|
||||||
$sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL");
|
$sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL");
|
||||||
$sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
|
$sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
|
||||||
$sql .= ", ".(!empty($this->ref_customer) ? ("'".$this->db->escape($this->ref_customer)."'") : "NULL");
|
$sql .= ", ".(!empty($this->ref_customer) ? ("'".$this->db->escape($this->ref_customer)."'") : "NULL");
|
||||||
|
|||||||
@ -244,7 +244,7 @@ $sql .= ' SUM('.$db->ifsql("cd.statut=5", 1, 0).') as nb_closed';
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -235,7 +235,7 @@ $sql .= " cd.tms as date_update";
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -226,7 +226,7 @@ class CProductNature // extends CommonObject
|
|||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -253,7 +253,7 @@ class Ctyperesource
|
|||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -269,7 +269,7 @@ class CUnits // extends CommonObject
|
|||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -286,7 +286,7 @@ class DefaultValues extends CommonObject
|
|||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -622,10 +622,10 @@ class Notify
|
|||||||
if ($mailfile->sendfile()) {
|
if ($mailfile->sendfile()) {
|
||||||
if ($obj->type_target == 'touserid') {
|
if ($obj->type_target == 'touserid') {
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
|
||||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid ? $object->socid : 'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", ".((int) $obj->cid).", '".$this->db->escape($obj->type)."', '".$this->db->escape($object_type)."', '".$this->db->escape($obj->type_target)."', ".((int) $object->id).", '".$this->db->escape($obj->email)."')";
|
||||||
} else {
|
} else {
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)";
|
||||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid ? $object->socid : 'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", ".((int) $obj->cid).", '".$this->db->escape($obj->type)."', '".$this->db->escape($object_type)."', '".$this->db->escape($obj->type_target)."', ".((int) $object->id).", '".$this->db->escape($obj->email)."')";
|
||||||
}
|
}
|
||||||
if (!$this->db->query($sql)) {
|
if (!$this->db->query($sql)) {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
@ -857,7 +857,7 @@ class Notify
|
|||||||
|
|
||||||
if ($mailfile->sendfile()) {
|
if ($mailfile->sendfile()) {
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
|
||||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid ? $object->socid : 'null').", null, 'email', 'tofixedemail', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
|
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", null, 'email', 'tofixedemail', '".$this->db->escape($object_type)."', ".((int) $object->id).", '".$this->db->escape($conf->global->$param)."')";
|
||||||
if (!$this->db->query($sql)) {
|
if (!$this->db->query($sql)) {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -203,9 +203,9 @@ abstract class DoliDB implements Database
|
|||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
}
|
}
|
||||||
if ($offset > 0) {
|
if ($offset > 0) {
|
||||||
return " LIMIT $offset,$limit ";
|
return " LIMIT ".((int) $offset).",".((int) $limit)." ";
|
||||||
} else {
|
} else {
|
||||||
return " LIMIT $limit ";
|
return " LIMIT ".((int) $limit)." ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1806,7 +1806,7 @@ function addDocumentModel($name, $type, $label = '', $description = '')
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
||||||
$sql .= " VALUES ('".$db->escape($name)."','".$db->escape($type)."',".$conf->entity.", ";
|
$sql .= " VALUES ('".$db->escape($name)."','".$db->escape($type)."',".((int) $conf->entity).", ";
|
||||||
$sql .= ($label ? "'".$db->escape($label)."'" : 'null').", ";
|
$sql .= ($label ? "'".$db->escape($label)."'" : 'null').", ";
|
||||||
$sql .= (!empty($description) ? "'".$db->escape($description)."'" : "null");
|
$sql .= (!empty($description) ? "'".$db->escape($description)."'" : "null");
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|||||||
@ -1815,7 +1815,7 @@ function dol_set_user_param($db, $conf, &$user, $tab)
|
|||||||
// Set new parameters
|
// Set new parameters
|
||||||
if ($value) {
|
if ($value) {
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."user_param(fk_user,entity,param,value)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."user_param(fk_user,entity,param,value)";
|
||||||
$sql .= " VALUES (".((int) $user->id).",".$conf->entity.",";
|
$sql .= " VALUES (".((int) $user->id).",".((int) $conf->entity).",";
|
||||||
$sql .= " '".$db->escape($key)."','".$db->escape($value)."')";
|
$sql .= " '".$db->escape($key)."','".$db->escape($value)."')";
|
||||||
|
|
||||||
dol_syslog("functions2.lib::dol_set_user_param", LOG_DEBUG);
|
dol_syslog("functions2.lib::dol_set_user_param", LOG_DEBUG);
|
||||||
|
|||||||
@ -1223,7 +1223,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id, position, box_order, fk_user, entity)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id, position, box_order, fk_user, entity)";
|
||||||
$sql .= " VALUES (".$lastid.", ".$key2.", '0', 0, ".$conf->entity.")";
|
$sql .= " VALUES (".((int) $lastid).", ".((int) $key2).", '0', 0, ".((int) $conf->entity).")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert_boxes onto page ".$key2."=".$val2."", LOG_DEBUG);
|
dol_syslog(get_class($this)."::insert_boxes onto page ".$key2."=".$val2."", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -2065,7 +2065,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
|
|
||||||
if ($row[0] == 0) {
|
if ($row[0] == 0) {
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,type,value,note,visible,entity)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,type,value,note,visible,entity)";
|
||||||
$sql .= " VALUES (".$this->db->encrypt($name, 1).",'chaine',".$this->db->encrypt($dir, 1).",'Directory for module ".$this->name."','0',".$conf->entity.")";
|
$sql .= " VALUES ('".$this->db->escape($this->db->encrypt($name))."', 'chaine', '".$this->db->escape($this->db->encrypt($dir))."', 'Directory for module ".$this->name."', '0', ".((int) $conf->entity).")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert_dirs", LOG_DEBUG);
|
dol_syslog(get_class($this)."::insert_dirs", LOG_DEBUG);
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
@ -2156,12 +2156,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
$sql .= ", entity";
|
$sql .= ", entity";
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
$sql .= " VALUES (";
|
$sql .= " VALUES (";
|
||||||
$sql .= $this->db->encrypt($this->const_name."_".strtoupper($key), 1);
|
$sql .= "'".$this->db->escape($this->db->encrypt($this->const_name."_".strtoupper($key)))."'";
|
||||||
$sql .= ", 'chaine'";
|
$sql .= ", 'chaine'";
|
||||||
$sql .= ", ".$this->db->encrypt($newvalue, 1);
|
$sql .= ", '".$this->db->escape($this->db->encrypt($newvalue))."'";
|
||||||
$sql .= ", null";
|
$sql .= ", null";
|
||||||
$sql .= ", '0'";
|
$sql .= ", '0'";
|
||||||
$sql .= ", ".$entity;
|
$sql .= ", ".((int) $entity);
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert_module_parts for key=".$this->const_name."_".strtoupper($key), LOG_DEBUG);
|
dol_syslog(get_class($this)."::insert_module_parts for key=".$this->const_name."_".strtoupper($key), LOG_DEBUG);
|
||||||
|
|||||||
@ -431,8 +431,8 @@ class modAdherent extends DolibarrModules
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type='member' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type='member' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".((int) $conf->entity).")"
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -503,8 +503,8 @@ class modBom extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
//"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'bom' AND entity = ".$conf->entity,
|
//"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'bom' AND entity = ".((int) $conf->entity),
|
||||||
//"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'bom', ".$conf->entity.")"
|
//"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'bom', ".((int) $conf->entity).")"
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -466,8 +466,8 @@ class modCommande extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'order' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'order' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','order',".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."', 'order', ".((int) $conf->entity).")"
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -33,7 +33,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
|||||||
*/
|
*/
|
||||||
class modContrat extends DolibarrModules
|
class modContrat extends DolibarrModules
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. Define names, constants, directories, boxes, permissions
|
* Constructor. Define names, constants, directories, boxes, permissions
|
||||||
*
|
*
|
||||||
@ -246,8 +245,8 @@ class modContrat extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[1][2])."' AND type = 'contract' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[1][2])."' AND type = 'contract' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[1][2])."','contract',".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[1][2])."', 'contract', ".((int) $conf->entity).")"
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -156,8 +156,8 @@ class modDon extends DolibarrModules
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'donation' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'donation' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','donation',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','donation',".((int) $conf->entity).")",
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -264,16 +264,6 @@ class modEmailCollector extends DolibarrModules
|
|||||||
public function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf, $user;
|
global $conf, $user;
|
||||||
//$this->_load_tables('/dav/sql/');
|
|
||||||
|
|
||||||
// Create extrafields
|
|
||||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
|
||||||
//$extrafields = new ExtraFields($this->db);
|
|
||||||
//$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
|
||||||
//$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
|
||||||
//$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
|
||||||
//$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1 '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
|
||||||
//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
|
||||||
|
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
@ -285,17 +275,17 @@ class modEmailCollector extends DolibarrModules
|
|||||||
$descriptionA1 .= ' If the collector Collect_Responses is also enabled, when you send an email from the ticket, you may also see answers of your customers or partners directly on the ticket view.';
|
$descriptionA1 .= ' If the collector Collect_Responses is also enabled, when you send an email from the ticket, you may also see answers of your customers or partners directly on the ticket view.';
|
||||||
|
|
||||||
$sqlforexampleA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
$sqlforexampleA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Ticket_Requets', 'Example to collect ticket requests', '".$this->db->escape($descriptionA1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
|
$sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Ticket_Requets', 'Example to collect ticket requests', '".$this->db->escape($descriptionA1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 0)";
|
||||||
|
|
||||||
$sqlforexampleFilterA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleFilterA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleFilterA1 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'isnotanswer', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleFilterA1 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'isnotanswer', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
$sqlforexampleFilterA2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleFilterA2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleFilterA2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleFilterA2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
$sqlforexampleFilterA3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)";
|
$sqlforexampleFilterA3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleFilterA3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'to', 'support@example.com', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleFilterA3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'to', 'support@example.com', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
|
|
||||||
$sqlforexampleA4 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleA4 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleA4 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'ticket', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleA4 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'ticket', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
|
|
||||||
$sql[] = $sqlforexampleA1;
|
$sql[] = $sqlforexampleA1;
|
||||||
$sql[] = $sqlforexampleFilterA1;
|
$sql[] = $sqlforexampleFilterA1;
|
||||||
@ -314,14 +304,14 @@ class modEmailCollector extends DolibarrModules
|
|||||||
$descriptionA1 = 'This collector will scan your mailbox "Sent" directory to find emails that was sent as an answer of another email directly from your email software and not from Dolibarr. If such an email is found, the event of answer is recorded into Dolibarr.';
|
$descriptionA1 = 'This collector will scan your mailbox "Sent" directory to find emails that was sent as an answer of another email directly from your email software and not from Dolibarr. If such an email is found, the event of answer is recorded into Dolibarr.';
|
||||||
|
|
||||||
$sqlforexampleA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
$sqlforexampleA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Responses_Out', 'Example to collect answers to emails done from your external email software', '".$this->db->escape($descriptionA1)."', 'Sent', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
|
$sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Responses_Out', 'Example to collect answers to emails done from your external email software', '".$this->db->escape($descriptionA1)."', 'Sent', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 0)";
|
||||||
|
|
||||||
$sqlforexampleFilterA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleFilterA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleFilterA1 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_Out' and entity = ".$conf->entity."), 'isanswer', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleFilterA1 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_Out' and entity = ".((int) $conf->entity)."), 'isanswer', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
$sqlforexampleFilterA2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleFilterA2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleFilterA2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_Out' and entity = ".$conf->entity."), 'withouttrackingidinmsgid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleFilterA2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_Out' and entity = ".((int) $conf->entity)."), 'withouttrackingidinmsgid', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
$sqlforexampleActionA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleActionA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleActionA1 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_Out' and entity = ".$conf->entity."), 'recordevent', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleActionA1 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_Out' and entity = ".((int) $conf->entity)."), 'recordevent', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
|
|
||||||
$sql[] = $sqlforexampleA1;
|
$sql[] = $sqlforexampleA1;
|
||||||
$sql[] = $sqlforexampleFilterA1;
|
$sql[] = $sqlforexampleFilterA1;
|
||||||
@ -330,18 +320,18 @@ class modEmailCollector extends DolibarrModules
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_In' and entity = ".$conf->entity;
|
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_In' and entity = ".((int) $conf->entity);
|
||||||
$tmpresql = $this->db->query($tmpsql);
|
$tmpresql = $this->db->query($tmpsql);
|
||||||
if ($tmpresql) {
|
if ($tmpresql) {
|
||||||
if ($this->db->num_rows($tmpresql) == 0) {
|
if ($this->db->num_rows($tmpresql) == 0) {
|
||||||
$descriptionB1 = 'This collector will scan your mailbox to find all emails that are an answer of an email sent from your application. An event (Module Agenda must be enabled) with the email response will be recorded at the good place. For example, if your send a commercial proposal, order, invoice or message for a ticket by email from the application, and your customer answers your email, the system will automatically catch the answer and add it into your ERP.';
|
$descriptionB1 = 'This collector will scan your mailbox to find all emails that are an answer of an email sent from your application. An event (Module Agenda must be enabled) with the email response will be recorded at the good place. For example, if your send a commercial proposal, order, invoice or message for a ticket by email from the application, and your customer answers your email, the system will automatically catch the answer and add it into your ERP.';
|
||||||
|
|
||||||
$sqlforexampleB1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
$sqlforexampleB1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleB1 .= " VALUES (".$conf->entity.", 'Collect_Responses_In', 'Example to collect any received email that is a response of an email sent from Dolibarr', '".$this->db->escape($descriptionB1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
|
$sqlforexampleB1 .= " VALUES (".$conf->entity.", 'Collect_Responses_In', 'Example to collect any received email that is a response of an email sent from Dolibarr', '".$this->db->escape($descriptionB1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 0)";
|
||||||
$sqlforexampleB2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleB2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleB2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_In' and entity = ".$conf->entity."), 'isanswer', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleB2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_In' and entity = ".((int) $conf->entity)."), 'isanswer', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
$sqlforexampleB3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleB3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleB3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_In' and entity = ".$conf->entity."), 'recordevent', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleB3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses_In' and entity = ".((int) $conf->entity)."), 'recordevent', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
|
|
||||||
$sql[] = $sqlforexampleB1;
|
$sql[] = $sqlforexampleB1;
|
||||||
$sql[] = $sqlforexampleB2;
|
$sql[] = $sqlforexampleB2;
|
||||||
@ -351,7 +341,7 @@ class modEmailCollector extends DolibarrModules
|
|||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity;
|
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".((int) $conf->entity);
|
||||||
$tmpresql = $this->db->query($tmpsql);
|
$tmpresql = $this->db->query($tmpsql);
|
||||||
if ($tmpresql) {
|
if ($tmpresql) {
|
||||||
if ($this->db->num_rows($tmpresql) == 0) {
|
if ($this->db->num_rows($tmpresql) == 0) {
|
||||||
@ -360,17 +350,17 @@ class modEmailCollector extends DolibarrModules
|
|||||||
$descriptionC1 .= "Note: With this initial example, the title of the lead is generated including the email. If the thirdparty can't be found in database (new customer), the lead will be attached to the thirdparty with ID 1.";
|
$descriptionC1 .= "Note: With this initial example, the title of the lead is generated including the email. If the thirdparty can't be found in database (new customer), the lead will be attached to the thirdparty with ID 1.";
|
||||||
|
|
||||||
$sqlforexampleC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
$sqlforexampleC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Leads', 'Example to collect leads', '".$this->db->escape($descriptionC1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
|
$sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Leads', 'Example to collect leads', '".$this->db->escape($descriptionC1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 0)";
|
||||||
|
|
||||||
$sqlforexampleFilterC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleFilterC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleFilterC1 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'isnotanswer', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleFilterC1 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".((int) $conf->entity)."), 'isnotanswer', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
$sqlforexampleFilterC2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleFilterC2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleFilterC2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleFilterC2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".((int) $conf->entity)."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
$sqlforexampleFilterC3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)";
|
$sqlforexampleFilterC3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleFilterC3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'to', 'sales@example.com', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleFilterC3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".((int) $conf->entity)."), 'to', 'sales@example.com', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
|
|
||||||
$sqlforexampleC4 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, actionparam, date_creation, fk_user_creat, status)";
|
$sqlforexampleC4 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, actionparam, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleC4 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'project', 'tmp_from=EXTRACT:HEADER:^From:(.*);socid=SETIFEMPTY:1;usage_opportunity=SET:1;description=EXTRACT:BODY:(.*);title=SET:Lead or message from __tmp_from__ received by email', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleC4 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".((int) $conf->entity)."), 'project', 'tmp_from=EXTRACT:HEADER:^From:(.*);socid=SETIFEMPTY:1;usage_opportunity=SET:1;description=EXTRACT:BODY:(.*);title=SET:Lead or message from __tmp_from__ received by email', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
|
|
||||||
$sql[] = $sqlforexampleC1;
|
$sql[] = $sqlforexampleC1;
|
||||||
$sql[] = $sqlforexampleFilterC1;
|
$sql[] = $sqlforexampleFilterC1;
|
||||||
@ -382,7 +372,7 @@ class modEmailCollector extends DolibarrModules
|
|||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".$conf->entity;
|
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".((int) $conf->entity);
|
||||||
$tmpresql = $this->db->query($tmpsql);
|
$tmpresql = $this->db->query($tmpsql);
|
||||||
if ($tmpresql) {
|
if ($tmpresql) {
|
||||||
if ($this->db->num_rows($tmpresql) == 0) {
|
if ($this->db->num_rows($tmpresql) == 0) {
|
||||||
@ -390,17 +380,17 @@ class modEmailCollector extends DolibarrModules
|
|||||||
$descriptionC1 .= "Note: With this initial example, the title of the candidature is generated including the email.";
|
$descriptionC1 .= "Note: With this initial example, the title of the candidature is generated including the email.";
|
||||||
|
|
||||||
$sqlforexampleC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
$sqlforexampleC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Candidatures', 'Example to collect email for job candidatures', '".$this->db->escape($descriptionC1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
|
$sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Candidatures', 'Example to collect email for job candidatures', '".$this->db->escape($descriptionC1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 0)";
|
||||||
|
|
||||||
$sqlforexampleFilterC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleFilterC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleFilterC1 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".$conf->entity."), 'isnotanswer', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleFilterC1 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".((int) $conf->entity)."), 'isnotanswer', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
$sqlforexampleFilterC2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
$sqlforexampleFilterC2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleFilterC2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleFilterC2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".((int) $conf->entity)."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
$sqlforexampleFilterC3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)";
|
$sqlforexampleFilterC3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleFilterC3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".$conf->entity."), 'to', 'jobs@example.com', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleFilterC3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".((int) $conf->entity)."), 'to', 'jobs@example.com', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
|
|
||||||
$sqlforexampleC4 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, actionparam, date_creation, fk_user_creat, status)";
|
$sqlforexampleC4 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, actionparam, date_creation, fk_user_creat, status)";
|
||||||
$sqlforexampleC4 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".$conf->entity."), 'candidature', 'tmp_from=EXTRACT:HEADER:^From:(.*)(<.*>)?;fk_recruitmentjobposition=EXTRACT:HEADER:^To:[^\n]*\+([^\n]*);description=EXTRACT:BODY:(.*);lastname=SET:__tmp_from__', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
$sqlforexampleC4 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".((int) $conf->entity)."), 'candidature', 'tmp_from=EXTRACT:HEADER:^From:(.*)(<.*>)?;fk_recruitmentjobposition=EXTRACT:HEADER:^To:[^\n]*\+([^\n]*);description=EXTRACT:BODY:(.*);lastname=SET:__tmp_from__', '".$this->db->idate(dol_now())."', ".((int) $user->id).", 1)";
|
||||||
|
|
||||||
$sql[] = $sqlforexampleC1;
|
$sql[] = $sqlforexampleC1;
|
||||||
$sql[] = $sqlforexampleFilterC1;
|
$sql[] = $sqlforexampleFilterC1;
|
||||||
|
|||||||
@ -387,10 +387,10 @@ class modEventOrganization extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array_merge($sql, array(
|
$sql = array_merge($sql, array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".$this->db->escape(strtolower($myTmpObjectKey))."',".((int) $conf->entity).")",
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".$this->db->escape(strtolower($myTmpObjectKey))."', ".((int) $conf->entity).")"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -359,10 +359,10 @@ class modExpedition extends DolibarrModules
|
|||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'shipping' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'shipping' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','shipping',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','shipping',".((int) $conf->entity).")",
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'delivery' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'delivery' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','delivery',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','delivery',".((int) $conf->entity).")",
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -249,8 +249,8 @@ class modExpenseReport extends DolibarrModules
|
|||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard' AND type='expensereport' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard' AND type='expensereport' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard','expensereport',".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard','expensereport',".((int) $conf->entity).")"
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -458,8 +458,8 @@ class modFacture extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[1][2])."' AND type = 'invoice' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[1][2])."' AND type = 'invoice' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[1][2])."','invoice',".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[1][2])."','invoice',".((int) $conf->entity).")"
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -231,8 +231,8 @@ class modFicheinter extends DolibarrModules
|
|||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'ficheinter' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'ficheinter' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','ficheinter',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','ficheinter',".((int) $conf->entity).")",
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -857,8 +857,8 @@ class modFournisseur extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'order_supplier' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'order_supplier' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','order_supplier',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."', 'order_supplier', ".((int) $conf->entity).")",
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -336,8 +336,8 @@ class modHoliday extends DolibarrModules
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
// "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'holiday' AND entity = ".$conf->entity,
|
// "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'holiday' AND entity = ".((int) $conf->entity),
|
||||||
// "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','holiday',".$conf->entity.")"
|
// "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','holiday',".((int) $conf->entity).")"
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -474,10 +474,10 @@ class modKnowledgeManagement extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array_merge($sql, array(
|
$sql = array_merge($sql, array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".((int) $conf->entity).")",
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".((int) $conf->entity).")"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -352,8 +352,8 @@ class modMrp extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
//"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'mo' AND entity = ".$conf->entity,
|
//"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'mo' AND entity = ".((int) $conf->entity),
|
||||||
//"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'mo', ".$conf->entity.")"
|
//"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'mo', ".((int) $conf->entity).")"
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -453,10 +453,10 @@ class modPartnership extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array_merge($sql, array(
|
$sql = array_merge($sql, array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".((int) $conf->entity).")",
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".((int) $conf->entity).")"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,8 +145,8 @@ class modPrelevement extends DolibarrModules
|
|||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".((int) $conf->entity).")",
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -366,12 +366,12 @@ class modProjet extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array();
|
$sql = array();
|
||||||
$sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'task' AND entity = ".$conf->entity;
|
$sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'task' AND entity = ".((int) $conf->entity);
|
||||||
$sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','task',".$conf->entity.")";
|
$sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','task',".((int) $conf->entity).")";
|
||||||
$sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'beluga' AND type = 'project' AND entity = ".$conf->entity;
|
$sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'beluga' AND type = 'project' AND entity = ".((int) $conf->entity);
|
||||||
$sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('beluga','project',".$conf->entity.")";
|
$sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('beluga','project',".((int) $conf->entity).")";
|
||||||
$sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'baleine' AND type = 'project' AND entity = ".$conf->entity;
|
$sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'baleine' AND type = 'project' AND entity = ".((int) $conf->entity);
|
||||||
$sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('baleine','project',".$conf->entity.")";
|
$sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('baleine','project',".((int) $conf->entity).")";
|
||||||
|
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -470,8 +470,8 @@ class modPropale extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'propal' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'propal' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','propal',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','propal',".((int) $conf->entity).")",
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -282,8 +282,8 @@ class modReception extends DolibarrModules
|
|||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'reception' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'reception' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','reception',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','reception',".((int) $conf->entity).")",
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -448,10 +448,10 @@ class modRecruitment extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array_merge($sql, array(
|
$sql = array_merge($sql, array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".$this->db->escape(strtolower($myTmpObjectKey))."',".((int) $conf->entity).")",
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".$this->db->escape(strtolower($myTmpObjectKey))."', ".((int) $conf->entity).")"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
|||||||
*/
|
*/
|
||||||
class modStock extends DolibarrModules
|
class modStock extends DolibarrModules
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. Define names, constants, directories, boxes, permissions
|
* Constructor. Define names, constants, directories, boxes, permissions
|
||||||
*
|
*
|
||||||
@ -454,10 +453,10 @@ class modStock extends DolibarrModules
|
|||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[1][2])."' AND type = 'stock' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[1][2])."' AND type = 'stock' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[1][2])."','stock',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[1][2])."','stock',".((int) $conf->entity).")",
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[2][2])."' AND type = 'mouvement' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[2][2])."' AND type = 'mouvement' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[2][2])."','mouvement',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[2][2])."','mouvement',".((int) $conf->entity).")",
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -179,8 +179,8 @@ class modSupplierProposal extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'supplier_proposal' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'supplier_proposal' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','supplier_proposal',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','supplier_proposal',".((int) $conf->entity).")",
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -344,8 +344,8 @@ class modTicket extends DolibarrModules
|
|||||||
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110121, 'ticket', 'internal', 'CONTRIBUTOR', 'Intervenant', 1);", "ignoreerror" => 1),
|
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110121, 'ticket', 'internal', 'CONTRIBUTOR', 'Intervenant', 1);", "ignoreerror" => 1),
|
||||||
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110122, 'ticket', 'external', 'SUPPORTCLI', 'Contact client suivi incident', 1);", "ignoreerror" => 1),
|
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110122, 'ticket', 'external', 'SUPPORTCLI', 'Contact client suivi incident', 1);", "ignoreerror" => 1),
|
||||||
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110123, 'ticket', 'external', 'CONTRIBUTOR', 'Intervenant', 1);", "ignoreerror" => 1),
|
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110123, 'ticket', 'external', 'CONTRIBUTOR', 'Intervenant', 1);", "ignoreerror" => 1),
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'TICKET_ADDON_PDF_ODT_PATH' AND type = 'ticket' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'TICKET_ADDON_PDF_ODT_PATH' AND type = 'ticket' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('TICKET_ADDON_PDF_ODT_PATH','ticket',".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('TICKET_ADDON_PDF_ODT_PATH','ticket',".((int) $conf->entity).")"
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -435,10 +435,10 @@ class modWorkstation extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = array_merge($sql, array(
|
$sql = array_merge($sql, array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".$this->db->escape(strtolower($myTmpObjectKey))."',".((int) $conf->entity).")",
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".$this->db->escape(strtolower($myTmpObjectKey))."', ".((int) $conf->entity).")"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -278,7 +278,7 @@ class pdf_stdandard extends ModelePDFMovement
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$element]['label'])) {
|
if (!empty($extrafields->attributes[$element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -548,7 +548,7 @@ class EcmFiles extends CommonObject
|
|||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
|
|||||||
@ -313,7 +313,7 @@ class ConferenceOrBooth extends ActionComm
|
|||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -434,7 +434,7 @@ class ConferenceOrBoothAttendee extends CommonObject
|
|||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -449,7 +449,7 @@ $sql .= $object->getFieldList('t');
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -225,7 +225,7 @@ $sql .= $object->getFieldList('t');
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -245,7 +245,7 @@ if ($search_categ_cus) {
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -497,7 +497,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql .= " , detail_refuse = ".(!empty($this->detail_refuse) ? "'".$this->db->escape($this->detail_refuse)."'" : "''");
|
$sql .= " , detail_refuse = ".(!empty($this->detail_refuse) ? "'".$this->db->escape($this->detail_refuse)."'" : "''");
|
||||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
if (!$notrigger) {
|
if (!$notrigger) {
|
||||||
@ -552,7 +552,7 @@ class ExpenseReport extends CommonObject
|
|||||||
}
|
}
|
||||||
//$sql.= $restrict;
|
//$sql.= $restrict;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
@ -665,7 +665,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql .= " SET fk_statut = ".self::STATUS_CLOSED.", paid=1";
|
$sql .= " SET fk_statut = ".self::STATUS_CLOSED.", paid=1";
|
||||||
$sql .= " WHERE rowid = ".((int) $id)." AND fk_statut = ".self::STATUS_APPROVED;
|
$sql .= " WHERE rowid = ".((int) $id)." AND fk_statut = ".self::STATUS_APPROVED;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::set_paid sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::set_paid", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
if ($this->db->affected_rows($resql)) {
|
if ($this->db->affected_rows($resql)) {
|
||||||
@ -882,7 +882,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as de";
|
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as de";
|
||||||
$sql .= " WHERE de.fk_projet = ".((int) $projectid);
|
$sql .= " WHERE de.fk_projet = ".((int) $projectid);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
@ -1353,7 +1353,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql .= " SET fk_statut = ".self::STATUS_VALIDATED;
|
$sql .= " SET fk_statut = ".self::STATUS_VALIDATED;
|
||||||
$sql .= ' WHERE rowid = '.$this->id;
|
$sql .= ' WHERE rowid = '.$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::set_save_from_refuse sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::set_save_from_refuse", LOG_DEBUG);
|
||||||
|
|
||||||
if ($this->db->query($sql)) {
|
if ($this->db->query($sql)) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -1509,7 +1509,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql .= " SET paid = 0, fk_statut = ".self::STATUS_APPROVED;
|
$sql .= " SET paid = 0, fk_statut = ".self::STATUS_APPROVED;
|
||||||
$sql .= ' WHERE rowid = '.$this->id;
|
$sql .= ' WHERE rowid = '.$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::set_unpaid sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::set_unpaid", LOG_DEBUG);
|
||||||
|
|
||||||
if ($this->db->query($sql)) {
|
if ($this->db->query($sql)) {
|
||||||
if (!$notrigger) {
|
if (!$notrigger) {
|
||||||
@ -1563,7 +1563,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql .= " ,detail_cancel='".$this->db->escape($detail)."'";
|
$sql .= " ,detail_cancel='".$this->db->escape($detail)."'";
|
||||||
$sql .= ' WHERE rowid = '.$this->id;
|
$sql .= ' WHERE rowid = '.$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::set_cancel sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::set_cancel", LOG_DEBUG);
|
||||||
|
|
||||||
if ($this->db->query($sql)) {
|
if ($this->db->query($sql)) {
|
||||||
if (!$notrigger) {
|
if (!$notrigger) {
|
||||||
|
|||||||
@ -277,7 +277,7 @@ $sql .= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.email, u.statu
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -231,7 +231,7 @@ if (!empty($conf->contrat->enabled)) {
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
|
|||||||
@ -2537,10 +2537,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet";
|
||||||
$sql .= " (fk_commande, label, description, fk_product, price, qty, tva_tx, localtax1_tx, localtax2_tx, remise_percent, subprice, remise, ref)";
|
$sql .= " (fk_commande, label, description, fk_product, price, qty, tva_tx, localtax1_tx, localtax2_tx, remise_percent, subprice, remise, ref)";
|
||||||
$sql .= " VALUES (".$idc.", '".$this->db->escape($label)."', ".$this->db->escape($comclient->lines[$i]->desc);
|
$sql .= " VALUES (".((int) $idc).", '".$this->db->escape($label)."', '".$this->db->escape($comclient->lines[$i]->desc)."'";
|
||||||
$sql .= ",".$comclient->lines[$i]->fk_product.", ".price2num($comclient->lines[$i]->price);
|
$sql .= ",".$comclient->lines[$i]->fk_product.", ".price2num($comclient->lines[$i]->price, 'MU');
|
||||||
$sql .= ", ".$comclient->lines[$i]->qty.", ".$comclient->lines[$i]->tva_tx.", ".$comclient->lines[$i]->localtax1_tx.", ".$comclient->lines[$i]->localtax2_tx.", ".$comclient->lines[$i]->remise_percent;
|
$sql .= ", ".price2num($comclient->lines[$i]->qty, 'MS').", ".price2num($comclient->lines[$i]->tva_tx, 5).", ".price2num($comclient->lines[$i]->localtax1_tx, 5).", ".price2num($comclient->lines[$i]->localtax2_tx, 5).", ".price2num($comclient->lines[$i]->remise_percent, 3);
|
||||||
$sql .= ", '".price2num($comclient->lines[$i]->subprice)."','0', '".$this->db->escape($ref)."');";
|
$sql .= ", '".price2num($comclient->lines[$i]->subprice, 'MT')."','0', '".$this->db->escape($ref)."');";
|
||||||
if ($this->db->query($sql)) {
|
if ($this->db->query($sql)) {
|
||||||
$this->update_price();
|
$this->update_price();
|
||||||
}
|
}
|
||||||
@ -2564,8 +2564,8 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur';
|
||||||
$sql .= ' SET fk_statut='.$status;
|
$sql .= " SET fk_statut = ".$status;
|
||||||
$sql .= ' WHERE rowid = '.$this->id;
|
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::setStatus", LOG_DEBUG);
|
dol_syslog(get_class($this)."::setStatus", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -684,7 +684,7 @@ class CommandeFournisseurDispatch extends CommonObject
|
|||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user