Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 14.0
This commit is contained in:
commit
aa8932a3a4
@ -55,8 +55,8 @@ class AccountancyImport
|
|||||||
$fieldname = $fieldArr[1];
|
$fieldname = $fieldArr[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$debit = trim($arrayrecord[11]['val']);
|
$debit = floatval(trim($arrayrecord[11]['val']));
|
||||||
$credit = trim($arrayrecord[12]['val']);
|
$credit = floatval(trim($arrayrecord[12]['val']));
|
||||||
if (!empty($debit)) {
|
if (!empty($debit)) {
|
||||||
$amount = $debit;
|
$amount = $debit;
|
||||||
} else {
|
} else {
|
||||||
@ -86,7 +86,7 @@ class AccountancyImport
|
|||||||
$fieldname = $fieldArr[1];
|
$fieldname = $fieldArr[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$debit = trim($arrayrecord[11]['val']);
|
$debit = floatval(trim($arrayrecord[11]['val']));
|
||||||
if (!empty($debit)) {
|
if (!empty($debit)) {
|
||||||
$sens = 'D';
|
$sens = 'D';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -331,7 +331,7 @@ class BookKeeping extends CommonObject
|
|||||||
if (empty($this->piece_num)) {
|
if (empty($this->piece_num)) {
|
||||||
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
||||||
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features
|
$sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
$resqlnum = $this->db->query($sqlnum);
|
$resqlnum = $this->db->query($sqlnum);
|
||||||
if ($resqlnum) {
|
if ($resqlnum) {
|
||||||
@ -736,7 +736,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " t.date_validated as date_validation";
|
$sql .= " t.date_validated as date_validation";
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t';
|
||||||
$sql .= ' WHERE 1 = 1';
|
$sql .= ' WHERE 1 = 1';
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
if (null !== $ref) {
|
if (null !== $ref) {
|
||||||
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
|
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
|
||||||
} else {
|
} else {
|
||||||
@ -881,7 +881,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||||
$sql .= ' WHERE 1 = 1';
|
$sql .= ' WHERE 1 = 1';
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
||||||
}
|
}
|
||||||
@ -1037,7 +1037,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
|
$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
if ($showAlreadyExportMovements == 0) {
|
if ($showAlreadyExportMovements == 0) {
|
||||||
$sql .= " AND t.date_export IS NULL";
|
$sql .= " AND t.date_export IS NULL";
|
||||||
}
|
}
|
||||||
@ -1157,7 +1157,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= ' WHERE entity IN ('.getEntity('accountancy').')';
|
$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
||||||
}
|
}
|
||||||
@ -1454,7 +1454,7 @@ class BookKeeping extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0)
|
public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
if (empty($delyear) && empty($journal)) {
|
if (empty($delyear) && empty($journal)) {
|
||||||
$this->error = 'ErrorOneFieldRequired';
|
$this->error = 'ErrorOneFieldRequired';
|
||||||
@ -1475,7 +1475,7 @@ class BookKeeping extends CommonObject
|
|||||||
if (!empty($journal)) {
|
if (!empty($journal)) {
|
||||||
$sql .= " AND code_journal = '".$this->db->escape($journal)."'";
|
$sql .= " AND code_journal = '".$this->db->escape($journal)."'";
|
||||||
}
|
}
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
// Exclusion of validated entries at the time of deletion
|
// Exclusion of validated entries at the time of deletion
|
||||||
$sql .= " AND date_validated IS NULL";
|
$sql .= " AND date_validated IS NULL";
|
||||||
|
|
||||||
@ -1514,7 +1514,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql .= " WHERE piece_num = ".(int) $piecenum;
|
$sql .= " WHERE piece_num = ".(int) $piecenum;
|
||||||
$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
|
$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
@ -1636,7 +1636,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||||
$sql .= " WHERE piece_num = ".$piecenum;
|
$sql .= " WHERE piece_num = ".$piecenum;
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -1674,9 +1674,9 @@ class BookKeeping extends CommonObject
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$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 = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(get_class($this)."getNextNumMvt sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::getNextNumMvt sql=".$sql, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@ -1717,7 +1717,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||||
$sql .= " WHERE piece_num = ".$piecenum;
|
$sql .= " WHERE piece_num = ".$piecenum;
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -1780,7 +1780,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,";
|
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,";
|
||||||
$sql .= " date_validated as date_validation";
|
$sql .= " date_validated as date_validation";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
|
$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG);
|
dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG);
|
||||||
|
|
||||||
@ -1836,6 +1836,8 @@ class BookKeeping extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function transformTransaction($direction = 0, $piece_num = '')
|
public function transformTransaction($direction = 0, $piece_num = '')
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -1855,14 +1857,14 @@ class BookKeeping extends CommonObject
|
|||||||
$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, '.$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).' AND entity = ' .((int) $conf->entity);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -1870,7 +1872,7 @@ class BookKeeping extends CommonObject
|
|||||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
} elseif ($direction == 1) {
|
} elseif ($direction == 1) {
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -1885,14 +1887,14 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
$sql .= ' doc_ref, fk_doc, fk_docdet, 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, piece_num';
|
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num);
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -1947,7 +1949,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND aa.active = 1";
|
$sql .= " AND aa.active = 1";
|
||||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
$sql .= " AND asy.rowid = ".((int) $pcgver);
|
$sql .= " AND asy.rowid = ".((int) $pcgver);
|
||||||
$sql .= " AND ab.entity IN (".getEntity('accountancy').")";
|
$sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
$sql .= " ORDER BY account_number ASC";
|
$sql .= " ORDER BY account_number ASC";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
|
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
|
||||||
@ -2011,7 +2013,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
|
||||||
$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 = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -2051,7 +2053,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND asy.rowid = ".((int) $pcgver);
|
$sql .= " AND asy.rowid = ".((int) $pcgver);
|
||||||
$sql .= " AND aa.active = 1";
|
$sql .= " AND aa.active = 1";
|
||||||
$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 = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -403,6 +403,7 @@ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
}
|
}
|
||||||
$sql .= " AND aa.account_number IS NOT NULL";
|
$sql .= " AND aa.account_number IS NOT NULL";
|
||||||
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
$sql .= ' ORDER BY aa.account_number';
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|||||||
@ -188,6 +188,7 @@ $sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseRepo
|
|||||||
$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
|
||||||
$sql .= " AND aa.account_number IS NULL";
|
$sql .= " AND aa.account_number IS NULL";
|
||||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
$sql .= ' ORDER BY aa.account_number';
|
||||||
|
|
||||||
dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql);
|
dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|||||||
@ -300,6 +300,7 @@ $sql .= " AND ffd.product_type <= 2";
|
|||||||
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||||
$sql .= " AND aa.account_number IS NULL";
|
$sql .= " AND aa.account_number IS NULL";
|
||||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
$sql .= ' ORDER BY aa.account_number';
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|||||||
@ -267,9 +267,9 @@ class Dolistore
|
|||||||
|
|
||||||
// add image or default ?
|
// add image or default ?
|
||||||
if ($product->id_default_image != '') {
|
if ($product->id_default_image != '') {
|
||||||
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.((int) $product->id).'&id_image='.((int) $product->id_default_image);
|
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode(((int) $product->id)).'&id_image='.urlencode(((int) $product->id_default_image));
|
||||||
$images = '<a href="'.urlencode($image_url).'" class="documentpreview" target="_blank" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
|
$images = '<a href="'.$image_url.'" class="documentpreview" target="_blank" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
|
||||||
$images .= '<img src="'.urlencode($image_url).'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
$images .= '<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
||||||
} else {
|
} else {
|
||||||
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
|
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
|
||||||
}
|
}
|
||||||
@ -277,11 +277,11 @@ class Dolistore
|
|||||||
// free or pay ?
|
// free or pay ?
|
||||||
if ($product->price > 0) {
|
if ($product->price > 0) {
|
||||||
$price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>';
|
$price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>';
|
||||||
$download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
$download_link = '<a target="_blank" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||||
} else {
|
} else {
|
||||||
$price = '<h3>'.$langs->trans('Free').'</h3>';
|
$price = '<h3>'.$langs->trans('Free').'</h3>';
|
||||||
$download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
|
$download_link = '<a target="_blank" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
|
||||||
$download_link .= '<br><br><a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
$download_link .= '<br><br><a target="_blank" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set and check version
|
// Set and check version
|
||||||
|
|||||||
@ -546,6 +546,7 @@ print '</form>';
|
|||||||
print '</fieldset>';
|
print '</fieldset>';
|
||||||
|
|
||||||
|
|
||||||
|
$title = $langs->trans("BackupZipWizard");
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print "<!-- Dump of a server -->\n";
|
print "<!-- Dump of a server -->\n";
|
||||||
@ -564,7 +565,7 @@ print '</span>';
|
|||||||
|
|
||||||
print '<div id="backupfilesleft" class="fichehalfleft">';
|
print '<div id="backupfilesleft" class="fichehalfleft">';
|
||||||
|
|
||||||
print load_fiche_titre($title ? $title : $langs->trans("BackupZipWizard"));
|
print load_fiche_titre($title);
|
||||||
|
|
||||||
print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
||||||
$prefix = 'documents';
|
$prefix = 'documents';
|
||||||
|
|||||||
@ -1041,7 +1041,7 @@ class Setup extends DolibarrApi
|
|||||||
* @param int $page Page number (starting from zero)
|
* @param int $page Page number (starting from zero)
|
||||||
* @param string $zipcode To filter on zipcode
|
* @param string $zipcode To filter on zipcode
|
||||||
* @param string $town To filter on city name
|
* @param string $town To filter on city name
|
||||||
* @param int $active Payment term is active or not {@min 0} {@max 1}
|
* @param int $active Town is active or not {@min 0} {@max 1}
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||||
* @return array List of towns
|
* @return array List of towns
|
||||||
*
|
*
|
||||||
@ -1055,7 +1055,7 @@ class Setup extends DolibarrApi
|
|||||||
|
|
||||||
$sql = "SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country";
|
$sql = "SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ziptown as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_ziptown as t";
|
||||||
$sql .= " AND t.active = ".((int) $active);
|
$sql .= " WHERE t.active = ".((int) $active);
|
||||||
if ($zipcode) {
|
if ($zipcode) {
|
||||||
$sql .= " AND t.zip LIKE '%".$this->db->escape($zipcode)."%'";
|
$sql .= " AND t.zip LIKE '%".$this->db->escape($zipcode)."%'";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,12 +55,27 @@ if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) {
|
|||||||
define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Response for preflight requests (used by browser when into a CORS context)
|
||||||
|
if (!empty($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'OPTIONS' && !empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
||||||
|
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
||||||
|
http_response_code(204);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool.
|
// When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool.
|
||||||
if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) {
|
if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) {
|
||||||
header('Access-Control-Allow-Origin: *');
|
header('Access-Control-Allow-Origin: *');
|
||||||
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
||||||
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
||||||
}
|
}
|
||||||
|
// When we request url to get an API, we accept Cross site so we can make js API call inside another website
|
||||||
|
if (preg_match('/\/api\/index\.php/', $_SERVER["PHP_SELF"])) {
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
||||||
|
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
||||||
|
}
|
||||||
|
|
||||||
$res = 0;
|
$res = 0;
|
||||||
if (!$res && file_exists("../main.inc.php")) {
|
if (!$res && file_exists("../main.inc.php")) {
|
||||||
@ -304,7 +319,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
|||||||
|
|
||||||
foreach ($listofendpoints as $endpointrule) {
|
foreach ($listofendpoints as $endpointrule) {
|
||||||
$tmparray = explode(':', $endpointrule);
|
$tmparray = explode(':', $endpointrule);
|
||||||
if ($classfile == $tmparray[0] && $tmparray[1] == 1) {
|
if (($classfile == $tmparray[0] || $classfile.'api' == $tmparray[0]) && $tmparray[1] == 1) {
|
||||||
$endpointisallowed = true;
|
$endpointisallowed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -326,7 +326,7 @@ if ($action == 'create') {
|
|||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print "\n".'<script type="text/javascript" language="javascript">';
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
print 'jQuery(document).ready(function () {
|
print 'jQuery(document).ready(function () {
|
||||||
jQuery("#selecttype").change(function() {
|
jQuery("#type").change(function() {
|
||||||
document.formsoc.action.value="create";
|
document.formsoc.action.value="create";
|
||||||
document.formsoc.submit();
|
document.formsoc.submit();
|
||||||
});
|
});
|
||||||
@ -349,16 +349,16 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOST("ref") ?GETPOST("ref", 'alpha') : $object->ref).'" maxlength="12" autofocus></td></tr>';
|
print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST("ref", 'alpha') : $object->ref).'" maxlength="12" autofocus></td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
||||||
print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(GETPOST("label", 'alpha')).'"></td></tr>';
|
print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(GETPOST('label', 'alpha')).'"></td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST("type") : Account::TYPE_CURRENT, "type");
|
$formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT, 'type');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Currency
|
// Currency
|
||||||
@ -376,7 +376,7 @@ if ($action == 'create') {
|
|||||||
// Status
|
// Status
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectarray("clos", $object->status, (GETPOST("clos", 'int') != '' ?GETPOST("clos", 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
|
print $form->selectarray("clos", $object->status, (GETPOST('clos', 'int') != '' ? GETPOST('clos', 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
@ -471,7 +471,7 @@ if ($action == 'create') {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$type = GETPOST('type');
|
$type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value
|
||||||
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
|
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
@ -820,7 +820,7 @@ if ($action == 'create') {
|
|||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print "\n".'<script type="text/javascript" language="javascript">';
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
print 'jQuery(document).ready(function () {
|
print 'jQuery(document).ready(function () {
|
||||||
jQuery("#selecttype").change(function() {
|
jQuery("#type").change(function() {
|
||||||
document.formsoc.action.value="edit";
|
document.formsoc.action.value="edit";
|
||||||
document.formsoc.submit();
|
document.formsoc.submit();
|
||||||
});
|
});
|
||||||
@ -848,16 +848,16 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET("ref") ? GETPOST("ref") : $object->ref).'"></td></tr>';
|
print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : $object->ref).'"></td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
|
||||||
print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET("label") ? GETPOST("label") : $object->label).'"></td></tr>';
|
print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET('label') ? GETPOST('label', 'alpha') : $object->label).'"></td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||||
print '<td class="maxwidth200onsmartphone">';
|
print '<td class="maxwidth200onsmartphone">';
|
||||||
$formbank->selectTypeOfBankAccount((GETPOSTISSET("type") ? GETPOST("type") : $object->type), "type");
|
$formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type), 'type');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Currency
|
// Currency
|
||||||
@ -878,7 +878,7 @@ if ($action == 'create') {
|
|||||||
// Status
|
// Status
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||||
print '<td class="maxwidth200onsmartphone">';
|
print '<td class="maxwidth200onsmartphone">';
|
||||||
print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos") : $object->clos));
|
print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos", "int") : $object->clos));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
@ -1002,7 +1002,8 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
if (GETPOST("type") == Account::TYPE_SAVINGS || GETPOST("type") == Account::TYPE_CURRENT) {
|
$type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value
|
||||||
|
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
//print '<div class="underbanner clearboth"></div>';
|
//print '<div class="underbanner clearboth"></div>';
|
||||||
|
|||||||
@ -1109,6 +1109,8 @@ if (empty($reshook)) {
|
|||||||
$facture_source->fetchPreviousNextSituationInvoice();
|
$facture_source->fetchPreviousNextSituationInvoice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
if ($id < 0) {
|
if ($id < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -1236,6 +1238,7 @@ if (empty($reshook)) {
|
|||||||
$line->multicurrency_total_tva = -$line->multicurrency_total_tva;
|
$line->multicurrency_total_tva = -$line->multicurrency_total_tva;
|
||||||
$line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
|
$line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
|
||||||
|
|
||||||
|
$line->context['createcreditnotefrominvoice'] = 1;
|
||||||
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
|
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
|
||||||
|
|
||||||
$object->lines[] = $line; // insert new line in current object
|
$object->lines[] = $line; // insert new line in current object
|
||||||
|
|||||||
@ -1,22 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||||
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -1159,6 +1160,9 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$object->fetch($fromid);
|
$object->fetch($fromid);
|
||||||
|
|
||||||
|
// Load source object
|
||||||
|
$objFrom = clone $object;
|
||||||
|
|
||||||
// Change socid if needed
|
// Change socid if needed
|
||||||
if (!empty($this->socid) && $this->socid != $object->socid) {
|
if (!empty($this->socid) && $this->socid != $object->socid) {
|
||||||
$objsoc = new Societe($this->db);
|
$objsoc = new Societe($this->db);
|
||||||
@ -1239,13 +1243,13 @@ class Facture extends CommonInvoice
|
|||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
} else {
|
} else {
|
||||||
// copy internal contacts
|
// copy internal contacts
|
||||||
if ($object->copy_linked_contact($this, 'internal') < 0) {
|
if ($object->copy_linked_contact($objFrom, 'internal') < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $object->error;
|
$this->error = $object->error;
|
||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
} elseif ($this->socid == $object->socid) {
|
} elseif ($object->socid == $objFrom->socid) {
|
||||||
// copy external contacts if same company
|
// copy external contacts if same company
|
||||||
if ($object->copy_linked_contact($this, 'external') < 0) {
|
if ($object->copy_linked_contact($objFrom, 'external') < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $object->error;
|
$this->error = $object->error;
|
||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
@ -1256,7 +1260,7 @@ class Facture extends CommonInvoice
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
// Hook of thirdparty module
|
// Hook of thirdparty module
|
||||||
if (is_object($hookmanager)) {
|
if (is_object($hookmanager)) {
|
||||||
$parameters = array('objFrom'=>$this);
|
$parameters = array('objFrom'=>$objFrom);
|
||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
|
|||||||
@ -185,6 +185,7 @@ $limit = 5;
|
|||||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
|
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||||
$sql .= " WHERE p.type = 'bank-transfer'";
|
$sql .= " WHERE p.type = 'bank-transfer'";
|
||||||
|
$sql .= " AND p.entity IN (".getEntity('invoice').")";
|
||||||
$sql .= " ORDER BY datec DESC";
|
$sql .= " ORDER BY datec DESC";
|
||||||
$sql .= $db->plimit($limit);
|
$sql .= $db->plimit($limit);
|
||||||
|
|
||||||
|
|||||||
@ -260,12 +260,20 @@ if ($id) {
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
if ($type == 'bank-transfer') {
|
||||||
|
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
|
} else {
|
||||||
|
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
||||||
|
}
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
|
$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
|
||||||
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
||||||
$sql .= " AND f.fk_soc = s.rowid";
|
$sql .= " AND f.fk_soc = s.rowid";
|
||||||
$sql .= " AND pf.fk_facture = f.rowid";
|
if ($type == 'bank-transfer') {
|
||||||
|
$sql .= " AND pf.fk_facture_fourn = f.rowid";
|
||||||
|
} else {
|
||||||
|
$sql .= " AND pf.fk_facture = f.rowid";
|
||||||
|
}
|
||||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||||
$sql .= " AND pl.rowid = ".((int) $id);
|
$sql .= " AND pl.rowid = ".((int) $id);
|
||||||
if ($socid) {
|
if ($socid) {
|
||||||
|
|||||||
@ -455,7 +455,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||||||
$_SERVER["PHP_SELF"],
|
$_SERVER["PHP_SELF"],
|
||||||
"amount",
|
"amount",
|
||||||
"",
|
"",
|
||||||
$classslink,
|
$paramslink,
|
||||||
'class="right"',
|
'class="right"',
|
||||||
$sortfield,
|
$sortfield,
|
||||||
$sortorder
|
$sortorder
|
||||||
|
|||||||
@ -1679,7 +1679,7 @@ class ExtraFields
|
|||||||
} elseif ($type == 'price') {
|
} elseif ($type == 'price') {
|
||||||
//$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
|
//$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
|
||||||
if ($value || $value == '0') {
|
if ($value || $value == '0') {
|
||||||
$value = price($value, 0, $langs, 0, 0, -1);
|
$value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$langs->getCurrencySymbol($conf->currency);
|
||||||
}
|
}
|
||||||
} elseif ($type == 'select') {
|
} elseif ($type == 'select') {
|
||||||
$valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : '');
|
$valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : '');
|
||||||
|
|||||||
@ -1060,11 +1060,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
|
|||||||
}
|
}
|
||||||
// Capital
|
// Capital
|
||||||
if ($fromcompany->capital) {
|
if ($fromcompany->capital) {
|
||||||
$tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string
|
$tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string or a float
|
||||||
if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
|
if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
|
||||||
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
|
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
|
||||||
} else {
|
} elseif (!empty($fromcompany->capital)) {
|
||||||
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", $tmpamounttoshow, $outputlangs);
|
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", $fromcompany->capital, $outputlangs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Prof Id 1
|
// Prof Id 1
|
||||||
|
|||||||
@ -736,6 +736,29 @@ class ImportCsv extends ModeleImports
|
|||||||
$tmp = explode('-', $val, 2);
|
$tmp = explode('-', $val, 2);
|
||||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||||
$listvalues[] = "'".$tmp[1]."'";
|
$listvalues[] = "'".$tmp[1]."'";
|
||||||
|
} elseif (preg_match('/^rule-/', $val)) {
|
||||||
|
$fieldname = $key;
|
||||||
|
if (!empty($objimport->array_import_convertvalue[0][$fieldname])) {
|
||||||
|
if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') {
|
||||||
|
$file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']);
|
||||||
|
$class = $objimport->array_import_convertvalue[0][$fieldname]['class'];
|
||||||
|
$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
|
||||||
|
$resultload = dol_include_once($file);
|
||||||
|
if (empty($resultload)) {
|
||||||
|
dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$classinstance = new $class($this->db);
|
||||||
|
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues));
|
||||||
|
if ($res < 0) {
|
||||||
|
if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict']));
|
||||||
|
else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
|
||||||
|
$this->errors[$error]['type'] = 'FOREIGNKEY';
|
||||||
|
$errorforthistable++;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden';
|
$this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden';
|
||||||
$this->errors[$error]['type'] = 'Import profile setup';
|
$this->errors[$error]['type'] = 'Import profile setup';
|
||||||
|
|||||||
@ -777,6 +777,29 @@ class ImportXlsx extends ModeleImports
|
|||||||
$tmp = explode('-', $val, 2);
|
$tmp = explode('-', $val, 2);
|
||||||
$listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
|
$listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
|
||||||
$listvalues[] = "'" . $tmp[1] . "'";
|
$listvalues[] = "'" . $tmp[1] . "'";
|
||||||
|
} elseif (preg_match('/^rule-/', $val)) {
|
||||||
|
$fieldname = $key;
|
||||||
|
if (!empty($objimport->array_import_convertvalue[0][$fieldname])) {
|
||||||
|
if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') {
|
||||||
|
$file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']);
|
||||||
|
$class = $objimport->array_import_convertvalue[0][$fieldname]['class'];
|
||||||
|
$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
|
||||||
|
$resultload = dol_include_once($file);
|
||||||
|
if (empty($resultload)) {
|
||||||
|
dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$classinstance = new $class($this->db);
|
||||||
|
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues));
|
||||||
|
if ($res < 0) {
|
||||||
|
if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict']));
|
||||||
|
else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
|
||||||
|
$this->errors[$error]['type'] = 'FOREIGNKEY';
|
||||||
|
$errorforthistable++;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden';
|
$this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden';
|
||||||
$this->errors[$error]['type'] = 'Import profile setup';
|
$this->errors[$error]['type'] = 'Import profile setup';
|
||||||
|
|||||||
@ -239,7 +239,7 @@ class modUser extends DolibarrModules
|
|||||||
'u.accountancy_code'=>'Text',
|
'u.accountancy_code'=>'Text',
|
||||||
'u.address'=>"Text", 'u.zip'=>"Text", 'u.town'=>"Text",
|
'u.address'=>"Text", 'u.zip'=>"Text", 'u.town'=>"Text",
|
||||||
'u.office_phone'=>'Text', 'u.user_mobile'=>'Text', 'u.office_fax'=>'Text',
|
'u.office_phone'=>'Text', 'u.user_mobile'=>'Text', 'u.office_fax'=>'Text',
|
||||||
'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.datelastlogin'=>'Date',
|
'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.signature'=>"Text", 'u.datelastlogin'=>'Date',
|
||||||
'u.fk_user'=>"List:user:login",
|
'u.fk_user'=>"List:user:login",
|
||||||
'u.birth'=>'Date',
|
'u.birth'=>'Date',
|
||||||
'u.datepreviouslogin'=>'Date', 'u.fk_soc'=>"List:societe:nom:rowid", 'u.fk_member'=>"List:adherent:firstname",
|
'u.datepreviouslogin'=>'Date', 'u.fk_soc'=>"List:societe:nom:rowid", 'u.fk_member'=>"List:adherent:firstname",
|
||||||
|
|||||||
@ -389,16 +389,17 @@ if ($step == 4 && $action == 'submitFormField') {
|
|||||||
$_SESSION["export_filtered_fields"] = array();
|
$_SESSION["export_filtered_fields"] = array();
|
||||||
foreach ($objexport->array_export_TypeFields[0] as $code => $type) { // $code: s.fieldname $value: Text|Boolean|List:ccc
|
foreach ($objexport->array_export_TypeFields[0] as $code => $type) { // $code: s.fieldname $value: Text|Boolean|List:ccc
|
||||||
$newcode = (string) preg_replace('/\./', '_', $code);
|
$newcode = (string) preg_replace('/\./', '_', $code);
|
||||||
//print 'xxx'.$code."=".$newcode."=".$type."=".$_POST[$newcode]."\n<br>";
|
//print 'xxx '.$code."=".$newcode."=".$type."=".$_POST[$newcode]."\n<br>";
|
||||||
|
$check = 'alphanohtml';
|
||||||
$filterqualified = 1;
|
$filterqualified = 1;
|
||||||
if (!GETPOSTISSET($newcode) || GETPOST($newcode, 'restricthtml') == '') {
|
if (!GETPOSTISSET($newcode) || GETPOST($newcode, $check) == '') {
|
||||||
$filterqualified = 0;
|
$filterqualified = 0;
|
||||||
} elseif (preg_match('/^List/', $type) && (is_numeric(GETPOST($newcode, 'restricthtml')) && GETPOST($newcode, 'restricthtml') <= 0)) {
|
} elseif (preg_match('/^List/', $type) && (is_numeric(GETPOST($newcode, $check)) && GETPOST($newcode, $check) <= 0)) {
|
||||||
$filterqualified = 0;
|
$filterqualified = 0;
|
||||||
}
|
}
|
||||||
if ($filterqualified) {
|
if ($filterqualified) {
|
||||||
//print 'Filter on '.$newcode.' type='.$type.' value='.$_POST[$newcode]."\n";
|
//print 'Filter on '.$newcode.' type='.$type.' value='.$_POST[$newcode]."\n";
|
||||||
$objexport->array_export_FilterValue[0][$code] = GETPOST($newcode, 'restricthtml');
|
$objexport->array_export_FilterValue[0][$code] = GETPOST($newcode, $check);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$array_filtervalue = (!empty($objexport->array_export_FilterValue[0]) ? $objexport->array_export_FilterValue[0] : '');
|
$array_filtervalue = (!empty($objexport->array_export_FilterValue[0]) ? $objexport->array_export_FilterValue[0] : '');
|
||||||
|
|||||||
@ -465,17 +465,21 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$sql .= " l.date_start, l.date_end,";
|
$sql .= " l.date_start, l.date_end,";
|
||||||
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc';
|
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc';
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||||
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging";
|
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging, MAX(pfp.quantity) as max_qty";
|
||||||
}
|
}
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
|
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND pfp.fk_soc = ".((int) $this->socid);
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND pfp.fk_soc = ".((int) $this->socid);
|
||||||
}
|
}
|
||||||
$sql .= " WHERE l.fk_commande = ".$this->id;
|
$sql .= " WHERE l.fk_commande = ".$this->id;
|
||||||
if ($only_product) {
|
if ($only_product) {
|
||||||
$sql .= ' AND p.fk_product_type = 0';
|
$sql .= ' AND p.fk_product_type = 0';
|
||||||
}
|
}
|
||||||
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||||
|
$sql.= " AND l.qty >= pfp.quantity ";
|
||||||
|
$sql.= " GROUP BY l.rowid HAVING max_qty = MAX(pfp.quantity) ";
|
||||||
|
}
|
||||||
$sql .= " ORDER BY l.rang, l.rowid";
|
$sql .= " ORDER BY l.rang, l.rowid";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
@ -3519,14 +3523,17 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||||||
$sql .= ' cd.date_start, cd.date_end, cd.fk_unit,';
|
$sql .= ' cd.date_start, cd.date_end, cd.fk_unit,';
|
||||||
$sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc';
|
$sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc';
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||||
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging";
|
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging, MAX(pfp.quantity) as max_qty";
|
||||||
}
|
}
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn";
|
||||||
}
|
}
|
||||||
$sql .= ' WHERE cd.rowid = '.((int) $rowid);
|
$sql .= ' WHERE cd.rowid = '.((int) $rowid);
|
||||||
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||||
|
$sql .= " AND cd.qty >= pfp.quantity GROUP BY cd.rowid HAVING max_qty = MAX(pfp.quantity)";
|
||||||
|
}
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
|
|||||||
@ -612,10 +612,11 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
// if ($mesg) print $mesg;
|
// if ($mesg) print $mesg;
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$disabled = 1;
|
/*$disabled = 1;
|
||||||
if (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
|
if (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
|
||||||
$disabled = 0;
|
$disabled = 0;
|
||||||
}
|
}*/
|
||||||
|
$disabled = 0; // This is used to disable or not the bulk selection of target warehouse. No reason to have it disabled so forced to 0.
|
||||||
|
|
||||||
// Line of orders
|
// Line of orders
|
||||||
if ($object->statut <= CommandeFournisseur::STATUS_ACCEPTED || $object->statut >= CommandeFournisseur::STATUS_CANCELED) {
|
if ($object->statut <= CommandeFournisseur::STATUS_ACCEPTED || $object->statut >= CommandeFournisseur::STATUS_CANCELED) {
|
||||||
|
|||||||
@ -1274,9 +1274,7 @@ if ($resql) {
|
|||||||
$projectstatic = new Project($db);
|
$projectstatic = new Project($db);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$totalarray = array();
|
$totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array());
|
||||||
$totalarray['nbfield'] = 0;
|
|
||||||
$totalarray['val'] = array();
|
|
||||||
$totalarray['val']['cf.total_ht'] = 0;
|
$totalarray['val']['cf.total_ht'] = 0;
|
||||||
$totalarray['val']['cf.total_ttc'] = 0;
|
$totalarray['val']['cf.total_ttc'] = 0;
|
||||||
while ($i < min($num, $limit)) {
|
while ($i < min($num, $limit)) {
|
||||||
|
|||||||
@ -529,9 +529,9 @@ if (empty($reshook)) {
|
|||||||
if ($line->product_type < 9 && $line->total_ht != 0) { // Remove lines with product_type greater than or equal to 9 and no need to create discount if amount is null
|
if ($line->product_type < 9 && $line->total_ht != 0) { // Remove lines with product_type greater than or equal to 9 and no need to create discount if amount is null
|
||||||
$keyforvatrate = $line->tva_tx.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : '');
|
$keyforvatrate = $line->tva_tx.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : '');
|
||||||
|
|
||||||
$amount_ht[$line->tva_tx] += $line->total_ht;
|
$amount_ht[$keyforvatrate] += $line->total_ht;
|
||||||
$amount_tva[$line->tva_tx] += $line->total_tva;
|
$amount_tva[$keyforvatrate] += $line->total_tva;
|
||||||
$amount_ttc[$line->tva_tx] += $line->total_ttc;
|
$amount_ttc[$keyforvatrate] += $line->total_ttc;
|
||||||
$multicurrency_amount_ht[$keyforvatrate] += $line->multicurrency_total_ht;
|
$multicurrency_amount_ht[$keyforvatrate] += $line->multicurrency_total_ht;
|
||||||
$multicurrency_amount_tva[$keyforvatrate] += $line->multicurrency_total_tva;
|
$multicurrency_amount_tva[$keyforvatrate] += $line->multicurrency_total_tva;
|
||||||
$multicurrency_amount_ttc[$keyforvatrate] += $line->multicurrency_total_ttc;
|
$multicurrency_amount_ttc[$keyforvatrate] += $line->multicurrency_total_ttc;
|
||||||
|
|||||||
@ -141,6 +141,7 @@ $endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : '');
|
|||||||
$updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array());
|
$updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array());
|
||||||
$separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ','));
|
$separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ','));
|
||||||
$enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"');
|
$enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"');
|
||||||
|
$separator_used = str_replace('\t', "\t", $separator);
|
||||||
|
|
||||||
$objimport = new Import($db);
|
$objimport = new Import($db);
|
||||||
$objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport));
|
$objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport));
|
||||||
@ -773,7 +774,7 @@ if ($step == 4 && $datatoimport) {
|
|||||||
require_once $dir.$file;
|
require_once $dir.$file;
|
||||||
$obj = new $classname($db, $datatoimport);
|
$obj = new $classname($db, $datatoimport);
|
||||||
if ($model == 'csv') {
|
if ($model == 'csv') {
|
||||||
$obj->separator = $separator;
|
$obj->separator = $separator_used;
|
||||||
$obj->enclosure = $enclosure;
|
$obj->enclosure = $enclosure;
|
||||||
}
|
}
|
||||||
if ($model == 'xlsx') {
|
if ($model == 'xlsx') {
|
||||||
@ -1334,7 +1335,7 @@ if ($step == 5 && $datatoimport) {
|
|||||||
require_once $dir.$file;
|
require_once $dir.$file;
|
||||||
$obj = new $classname($db, $datatoimport);
|
$obj = new $classname($db, $datatoimport);
|
||||||
if ($model == 'csv') {
|
if ($model == 'csv') {
|
||||||
$obj->separator = $separator;
|
$obj->separator = $separator_used;
|
||||||
$obj->enclosure = $enclosure;
|
$obj->enclosure = $enclosure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1783,7 +1784,7 @@ if ($step == 6 && $datatoimport) {
|
|||||||
require_once $dir.$file;
|
require_once $dir.$file;
|
||||||
$obj = new $classname($db, $datatoimport);
|
$obj = new $classname($db, $datatoimport);
|
||||||
if ($model == 'csv') {
|
if ($model == 'csv') {
|
||||||
$obj->separator = $separator;
|
$obj->separator = $separator_used;
|
||||||
$obj->enclosure = $enclosure;
|
$obj->enclosure = $enclosure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -192,7 +192,7 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (14
|
|||||||
|
|
||||||
-- MALI (id country=147)
|
-- MALI (id country=147)
|
||||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1471, 147, '0','0','VAT rate 0', 1);
|
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1471, 147, '0','0','VAT rate 0', 1);
|
||||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1471, 147, '18','0','VAT rate - standard', 1);
|
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1472, 147, '18','0','VAT rate - standard', 1);
|
||||||
|
|
||||||
-- MONACO (id country=27)
|
-- MONACO (id country=27)
|
||||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 271, 27, '0','0','VAT rate 0 ou non applicable',1);
|
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 271, 27, '0','0','VAT rate 0 ou non applicable',1);
|
||||||
@ -379,10 +379,6 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 4
|
|||||||
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 462, 46, '15','0','VAT 15%',1);
|
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 462, 46, '15','0','VAT 15%',1);
|
||||||
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 463, 46, '7.5','0','VAT 7.5%',1);
|
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 463, 46, '7.5','0','VAT 7.5%',1);
|
||||||
|
|
||||||
-- SOUTH AFRICA (id country=205)
|
|
||||||
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2051,205, '0','0','No VAT',1);
|
|
||||||
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2052,205, '14','0','VAT 14%',1);
|
|
||||||
|
|
||||||
-- VENEZUELA (id country=232)
|
-- VENEZUELA (id country=232)
|
||||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2321,232, '0','0','No VAT',1);
|
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2321,232, '0','0','No VAT',1);
|
||||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1);
|
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1);
|
||||||
|
|||||||
@ -649,3 +649,5 @@ ALTER TABLE llx_facture_fourn CHANGE COLUMN fk_mode_transport fk_transport_mode
|
|||||||
|
|
||||||
ALTER TABLE llx_c_socialnetworks DROP INDEX idx_c_socialnetworks_code;
|
ALTER TABLE llx_c_socialnetworks DROP INDEX idx_c_socialnetworks_code;
|
||||||
ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code_entity (code, entity);
|
ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code_entity (code, entity);
|
||||||
|
|
||||||
|
ALTER TABLE llx_propaldet ADD COLUMN import_key varchar(14);
|
||||||
|
|||||||
@ -1,29 +0,0 @@
|
|||||||
-- ============================================================================
|
|
||||||
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
--
|
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
|
||||||
-- it under the terms of the GNU General Public License as published by
|
|
||||||
-- the Free Software Foundation; either version 3 of the License, or
|
|
||||||
-- (at your option) any later version.
|
|
||||||
--
|
|
||||||
-- This program is distributed in the hope that it will be useful,
|
|
||||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
-- GNU General Public License for more details.
|
|
||||||
--
|
|
||||||
-- You should have received a copy of the GNU General Public License
|
|
||||||
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
-- ============================================================================
|
|
||||||
|
|
||||||
create table llx_onlinesignature
|
|
||||||
(
|
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
entity integer DEFAULT 1 NOT NULL,
|
|
||||||
object_type varchar(32) NOT NULL,
|
|
||||||
object_id integer NOT NULL,
|
|
||||||
datec datetime NOT NULL,
|
|
||||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
name varchar(255) NOT NULL,
|
|
||||||
ip varchar(128),
|
|
||||||
pathoffile varchar(255)
|
|
||||||
)ENGINE=innodb;
|
|
||||||
@ -1,8 +1,9 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||||
-- Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
-- Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
|
-- Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
|
||||||
--
|
--
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
-- it under the terms of the GNU General Public License as published by
|
-- it under the terms of the GNU General Public License as published by
|
||||||
@ -21,53 +22,55 @@
|
|||||||
|
|
||||||
create table llx_propaldet
|
create table llx_propaldet
|
||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_propal integer NOT NULL,
|
fk_propal integer NOT NULL,
|
||||||
fk_parent_line integer NULL,
|
fk_parent_line integer NULL,
|
||||||
fk_product integer NULL,
|
fk_product integer NULL,
|
||||||
label varchar(255) DEFAULT NULL,
|
label varchar(255) DEFAULT NULL,
|
||||||
description text,
|
description text,
|
||||||
fk_remise_except integer NULL, -- Lien vers table des remises fixes
|
fk_remise_except integer NULL, -- Link to table of fixed discounts
|
||||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||||
tva_tx double(6,3) DEFAULT 0, -- Vat rate
|
tva_tx double(6,3) DEFAULT 0, -- Vat rate
|
||||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||||
qty real, -- quantity
|
qty real, -- quantity
|
||||||
remise_percent real DEFAULT 0, -- pourcentage de remise
|
remise_percent real DEFAULT 0, -- discount percentage
|
||||||
remise real DEFAULT 0, -- montant de la remise (obsolete)
|
remise real DEFAULT 0, -- discount amount (obsolete)
|
||||||
price real, -- prix final (obsolete)
|
price real, -- final price (obsolete)
|
||||||
subprice double(24,8) DEFAULT 0, -- prix unitaire article
|
subprice double(24,8) DEFAULT 0, -- unit price article
|
||||||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
|
total_ht double(24,8) DEFAULT 0, -- Total excluding VAT of the line all quantities and including line and global discount
|
||||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
|
total_tva double(24,8) DEFAULT 0, -- Total VAT of the line any quantity and including discount line and global
|
||||||
total_localtax1 double(24,8) DEFAULT 0, -- Total localtax1
|
total_localtax1 double(24,8) DEFAULT 0, -- Total localtax1
|
||||||
total_localtax2 double(24,8) DEFAULT 0, -- Total localtax2
|
total_localtax2 double(24,8) DEFAULT 0, -- Total localtax2
|
||||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
|
total_ttc double(24,8) DEFAULT 0, -- Total TTC of the line all quantity and including line and global discount
|
||||||
product_type integer DEFAULT 0, -- 0 or 1. Value 9 may be used by some modules (amount of line may not be included into generated discount if value is 9).
|
product_type integer DEFAULT 0, -- 0 or 1. Value 9 may be used by some modules (amount of line may not be included into generated discount if value is 9).
|
||||||
date_start datetime DEFAULT NULL, -- date debut si service
|
date_start datetime DEFAULT NULL, -- start date if service
|
||||||
date_end datetime DEFAULT NULL, -- date fin si service
|
date_end datetime DEFAULT NULL, -- end date if service
|
||||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
info_bits integer DEFAULT 0, -- VAT NPR or not
|
||||||
|
|
||||||
buy_price_ht double(24,8) DEFAULT 0, -- buying price
|
buy_price_ht double(24,8) DEFAULT 0, -- buying price
|
||||||
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
|
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
|
||||||
|
|
||||||
special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
|
special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
|
||||||
rang integer DEFAULT 0, -- ordre affichage sur la propal
|
rang integer DEFAULT 0, -- order display on the propal
|
||||||
fk_unit integer DEFAULT NULL, -- lien vers table des unités
|
fk_unit integer DEFAULT NULL, -- link to table of units
|
||||||
|
|
||||||
fk_multicurrency integer,
|
fk_multicurrency integer,
|
||||||
multicurrency_code varchar(255),
|
multicurrency_code varchar(255),
|
||||||
multicurrency_subprice double(24,8) DEFAULT 0,
|
multicurrency_subprice double(24,8) DEFAULT 0,
|
||||||
multicurrency_total_ht double(24,8) DEFAULT 0,
|
multicurrency_total_ht double(24,8) DEFAULT 0,
|
||||||
multicurrency_total_tva double(24,8) DEFAULT 0,
|
multicurrency_total_tva double(24,8) DEFAULT 0,
|
||||||
multicurrency_total_ttc double(24,8) DEFAULT 0
|
multicurrency_total_ttc double(24,8) DEFAULT 0,
|
||||||
|
|
||||||
|
import_key varchar(14)
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Liste des codes pour special_code
|
-- List of codes for special_code
|
||||||
--
|
--
|
||||||
-- 1 : frais de port
|
-- 1 : shipping costs
|
||||||
-- 2 : ecotaxe
|
-- 2 : ecotax
|
||||||
-- 3 : produit/service propose en option
|
-- 3 : optional product/service
|
||||||
--
|
--
|
||||||
|
|||||||
@ -307,8 +307,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
|||||||
$filelist = array();
|
$filelist = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$from = '^'.$newversionfrom;
|
$from = '^'.preg_quote($newversionfrom, '/');
|
||||||
$to = $newversionto.'\.sql$';
|
$to = preg_quote($newversionto.'.sql', '/').'$';
|
||||||
|
|
||||||
// Get files list
|
// Get files list
|
||||||
$filesindir = array();
|
$filesindir = array();
|
||||||
@ -326,9 +326,9 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
|||||||
|
|
||||||
// Define which file to run
|
// Define which file to run
|
||||||
foreach ($filesindir as $file) {
|
foreach ($filesindir as $file) {
|
||||||
if (preg_match('/'.$from.'/i', $file)) {
|
if (preg_match('/'.$from.'\-/i', $file)) {
|
||||||
$filelist[] = $file;
|
$filelist[] = $file;
|
||||||
} elseif (preg_match('/'.$to.'/i', $file)) { // First test may be false if we migrate from x.y.* to x.y.*
|
} elseif (preg_match('/\-'.$to.'/i', $file)) { // First test may be false if we migrate from x.y.* to x.y.*
|
||||||
$filelist[] = $file;
|
$filelist[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,3 +41,5 @@ QCFrequency=Quality control frequency (in days)
|
|||||||
#Traceability - qc status
|
#Traceability - qc status
|
||||||
OutOfOrder=Out of order
|
OutOfOrder=Out of order
|
||||||
InWorkingOrder=In working order
|
InWorkingOrder=In working order
|
||||||
|
|
||||||
|
CantMoveNonExistantSerial=Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one.
|
||||||
|
|||||||
@ -42,3 +42,4 @@ HideLots=Masquer les lots
|
|||||||
#Traceability - qc status
|
#Traceability - qc status
|
||||||
OutOfOrder=Hors d'usage
|
OutOfOrder=Hors d'usage
|
||||||
InWorkingOrder=En état de marche
|
InWorkingOrder=En état de marche
|
||||||
|
CantMoveNonExistantSerial=Erreur : Vous avez demandé un mouvement sur un numéro de série qui n’existe plus. Peut-être avez-vous requis le même numéro de série plusieurs fois dans une même expédition, ou il a déjà servi dans une autre expédition. Supprimez cette expédition et préparez-en une autre.
|
||||||
|
|||||||
@ -5281,7 +5281,20 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
$stock_commande_fournisseur = $this->stats_commande_fournisseur['qty'];
|
$stock_commande_fournisseur = $this->stats_commande_fournisseur['qty'];
|
||||||
}
|
}
|
||||||
|
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled)) {
|
||||||
|
// Case module reception is not used
|
||||||
|
$filterStatus = '4';
|
||||||
|
if (isset($includedraftpoforvirtual)) {
|
||||||
|
$filterStatus = '0,'.$filterStatus;
|
||||||
|
}
|
||||||
|
$result = $this->load_stats_reception(0, $filterStatus, 1);
|
||||||
|
if ($result < 0) {
|
||||||
|
dol_print_error($this->db, $this->error);
|
||||||
|
}
|
||||||
|
$stock_reception_fournisseur = $this->stats_reception['qty'];
|
||||||
|
}
|
||||||
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->reception->enabled)) {
|
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->reception->enabled)) {
|
||||||
|
// Case module reception is used
|
||||||
$filterStatus = '4';
|
$filterStatus = '4';
|
||||||
if (isset($includedraftpoforvirtual)) {
|
if (isset($includedraftpoforvirtual)) {
|
||||||
$filterStatus = '0,'.$filterStatus;
|
$filterStatus = '0,'.$filterStatus;
|
||||||
|
|||||||
@ -146,11 +146,11 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
|||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid';
|
||||||
}
|
}
|
||||||
// We'll need this table joined to the select in order to filter by categ
|
// We'll need this table joined to the select in order to filter by categ
|
||||||
if ($search_categ) {
|
if ($search_categ > 0) {
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||||
}
|
}
|
||||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||||
if ($search_categ) {
|
if ($search_categ > 0) {
|
||||||
$sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
$sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
||||||
}
|
}
|
||||||
if ($sall) {
|
if ($sall) {
|
||||||
@ -267,7 +267,7 @@ if ($resql) {
|
|||||||
if ($search_sale) {
|
if ($search_sale) {
|
||||||
$param .= "&search_sale=".urlencode($search_sale);
|
$param .= "&search_sale=".urlencode($search_sale);
|
||||||
}
|
}
|
||||||
if ($search_categ) {
|
if ($search_categ > 0) {
|
||||||
$param .= "&search_categ=".urlencode($search_categ);
|
$param .= "&search_categ=".urlencode($search_categ);
|
||||||
}
|
}
|
||||||
if ($toolowstock) {
|
if ($toolowstock) {
|
||||||
@ -344,7 +344,7 @@ if ($resql) {
|
|||||||
if ($toolowstock) {
|
if ($toolowstock) {
|
||||||
$param .= "&toolowstock=".urlencode($toolowstock);
|
$param .= "&toolowstock=".urlencode($toolowstock);
|
||||||
}
|
}
|
||||||
if ($search_categ) {
|
if ($search_categ > 0) {
|
||||||
$param .= "&search_categ=".urlencode($search_categ);
|
$param .= "&search_categ=".urlencode($search_categ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -135,11 +135,11 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e on ps.fk_entrepot = e.rowid'
|
|||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = ps.rowid'; // Detail for each lot on each warehouse
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = ps.rowid'; // Detail for each lot on each warehouse
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; // Link on unique key
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; // Link on unique key
|
||||||
// We'll need this table joined to the select in order to filter by categ
|
// We'll need this table joined to the select in order to filter by categ
|
||||||
if ($search_categ) {
|
if ($search_categ > 0) {
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||||
}
|
}
|
||||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||||
if ($search_categ) {
|
if ($search_categ > 0) {
|
||||||
$sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
$sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
||||||
}
|
}
|
||||||
if ($sall) {
|
if ($sall) {
|
||||||
@ -178,7 +178,7 @@ if ($fourn_id > 0) {
|
|||||||
$sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".((int) $fourn_id);
|
$sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".((int) $fourn_id);
|
||||||
}
|
}
|
||||||
// Insert categ filter
|
// Insert categ filter
|
||||||
if ($search_categ) {
|
if ($search_categ > 0) {
|
||||||
$sql .= " AND cp.fk_categorie = ".((int) $search_categ);
|
$sql .= " AND cp.fk_categorie = ".((int) $search_categ);
|
||||||
}
|
}
|
||||||
if ($search_warehouse) {
|
if ($search_warehouse) {
|
||||||
@ -277,7 +277,7 @@ if ($resql) {
|
|||||||
if ($search_sale) {
|
if ($search_sale) {
|
||||||
$param .= "&search_sale=".urlencode($search_sale);
|
$param .= "&search_sale=".urlencode($search_sale);
|
||||||
}
|
}
|
||||||
if ($search_categ) {
|
if ($search_categ > 0) {
|
||||||
$param .= "&search_categ=".urlencode($search_categ);
|
$param .= "&search_categ=".urlencode($search_categ);
|
||||||
}
|
}
|
||||||
/*if ($eatby) $param.="&eatby=".$eatby;
|
/*if ($eatby) $param.="&eatby=".$eatby;
|
||||||
|
|||||||
@ -944,7 +944,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
|
|||||||
$delallowed = $usercancreate;
|
$delallowed = $usercancreate;
|
||||||
$modulepart = 'stock';
|
$modulepart = 'stock';
|
||||||
|
|
||||||
print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
|
print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
|
||||||
$somethingshown = $formfile->numoffiles;
|
$somethingshown = $formfile->numoffiles;
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|||||||
@ -842,7 +842,9 @@ class MouvementStock extends CommonObject
|
|||||||
*/
|
*/
|
||||||
private function createBatch($dluo, $qty)
|
private function createBatch($dluo, $qty)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user, $langs;
|
||||||
|
|
||||||
|
$langs->load('productbatch');
|
||||||
|
|
||||||
$pdluo = new Productbatch($this->db);
|
$pdluo = new Productbatch($this->db);
|
||||||
|
|
||||||
@ -853,7 +855,7 @@ class MouvementStock extends CommonObject
|
|||||||
$result = $pdluo->fetch($dluo);
|
$result = $pdluo->fetch($dluo);
|
||||||
if (empty($pdluo->id)) {
|
if (empty($pdluo->id)) {
|
||||||
// We didn't find the line. May be it was deleted before by a previous move in same transaction.
|
// We didn't find the line. May be it was deleted before by a previous move in same transaction.
|
||||||
$this->error = 'Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one.';
|
$this->error = $langs->trans('CantMoveNonExistantSerial');
|
||||||
$this->errors[] = $this->error;
|
$this->errors[] = $this->error;
|
||||||
$result = -2;
|
$result = -2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -249,7 +249,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
|||||||
$message = ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')).'<br><br>';
|
$message = ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')).'<br><br>';
|
||||||
$message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket').'<br>';
|
$message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket').'<br>';
|
||||||
|
|
||||||
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
|
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
|
||||||
$infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', '<a href="'.$url_public_ticket.'" rel="nofollow noopener">'.$object->track_id.'</a>').'<br>';
|
$infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', '<a href="'.$url_public_ticket.'" rel="nofollow noopener">'.$object->track_id.'</a>').'<br>';
|
||||||
$infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'<br><br>';
|
$infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'<br><br>';
|
||||||
|
|
||||||
|
|||||||
@ -1031,9 +1031,17 @@ if ($action == 'create') {
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $objectsrc->lines contains the line of the purchase order
|
||||||
|
// $dispatchLines is list of lines with dispatching detail (with product, qty and warehouse). One purchase order line may have n of this dispatch lines.
|
||||||
|
|
||||||
|
$arrayofpurchaselinealreadyoutput= array();
|
||||||
|
|
||||||
|
// $_POST contains fk_commandefourndet_X_Y where Y is num of product line and X is number of splitted line
|
||||||
$indiceAsked = 1;
|
$indiceAsked = 1;
|
||||||
while ($indiceAsked <= $numAsked) {
|
while ($indiceAsked <= $numAsked) { // Loop on $dispatchLines. Warning: $dispatchLines must be sorted by fk_commandefourndet (it is a regroupment key on output)
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
|
|
||||||
|
// We search the purchase order line that is linked to the dispatchLines
|
||||||
foreach ($objectsrc->lines as $supplierLine) {
|
foreach ($objectsrc->lines as $supplierLine) {
|
||||||
if ($dispatchLines[$indiceAsked]['fk_commandefourndet'] == $supplierLine->id) {
|
if ($dispatchLines[$indiceAsked]['fk_commandefourndet'] == $supplierLine->id) {
|
||||||
$line = $supplierLine;
|
$line = $supplierLine;
|
||||||
@ -1055,7 +1063,6 @@ if ($action == 'create') {
|
|||||||
print '<!-- line fk_commandefourndet='.$line->id.' for product='.$line->fk_product.' -->'."\n";
|
print '<!-- line fk_commandefourndet='.$line->id.' for product='.$line->fk_product.' -->'."\n";
|
||||||
print '<tr class="oddeven">'."\n";
|
print '<tr class="oddeven">'."\n";
|
||||||
|
|
||||||
|
|
||||||
// Product label
|
// Product label
|
||||||
if ($line->fk_product > 0) { // If predefined product
|
if ($line->fk_product > 0) { // If predefined product
|
||||||
$product->fetch($line->fk_product);
|
$product->fetch($line->fk_product);
|
||||||
@ -1064,42 +1071,45 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<a name="'.$line->id.'"></a>'; // ancre pour retourner sur la ligne
|
print '<a name="'.$line->id.'"></a>'; // ancre pour retourner sur la ligne
|
||||||
print '<input type="hidden" name="productid'.$indiceAsked.'" value="'.$line->fk_product.'">';
|
if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice
|
||||||
|
print '<input type="hidden" name="productid'.$indiceAsked.'" value="'.$line->fk_product.'">';
|
||||||
|
|
||||||
// Show product and description
|
// Show product and description
|
||||||
$product_static = $product;
|
$product_static = $product;
|
||||||
|
|
||||||
$text = $product_static->getNomUrl(1);
|
$text = $product_static->getNomUrl(1);
|
||||||
$text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label);
|
$text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label);
|
||||||
$description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc));
|
$description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc));
|
||||||
print $form->textwithtooltip($text, $description, 3, '', '', $i);
|
print $form->textwithtooltip($text, $description, 3, '', '', $i);
|
||||||
|
|
||||||
// Show range
|
// Show range
|
||||||
print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
|
print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
|
||||||
|
|
||||||
// Add description in form
|
// Add description in form
|
||||||
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
|
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
|
||||||
print ($line->desc && $line->desc != $line->product_label) ? '<br>'.dol_htmlentitiesbr($line->desc) : '';
|
print ($line->desc && $line->desc != $line->product_label) ? '<br>'.dol_htmlentitiesbr($line->desc) : '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if ($type == 1) {
|
if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice
|
||||||
$text = img_object($langs->trans('Service'), 'service');
|
if ($type == 1) {
|
||||||
} else {
|
$text = img_object($langs->trans('Service'), 'service');
|
||||||
$text = img_object($langs->trans('Product'), 'product');
|
} else {
|
||||||
}
|
$text = img_object($langs->trans('Product'), 'product');
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($line->label)) {
|
if (!empty($line->label)) {
|
||||||
$text .= ' <strong>'.$line->label.'</strong>';
|
$text .= ' <strong>'.$line->label.'</strong>';
|
||||||
print $form->textwithtooltip($text, $line->desc, 3, '', '', $i);
|
print $form->textwithtooltip($text, $line->desc, 3, '', '', $i);
|
||||||
} else {
|
} else {
|
||||||
print $text.' '.nl2br($line->desc);
|
print $text.' '.nl2br($line->desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show range
|
// Show range
|
||||||
print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
|
print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
|
||||||
|
}
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1110,8 +1120,11 @@ if ($action == 'create') {
|
|||||||
print '<input type="text" class="maxwidth100" name="comment'.$indiceAsked.'" value="'.$defaultcomment.'">';
|
print '<input type="text" class="maxwidth100" name="comment'.$indiceAsked.'" value="'.$defaultcomment.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Qty
|
// Qty in source purchase order line
|
||||||
print '<td class="center">'.$line->qty;
|
print '<td class="center">';
|
||||||
|
if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice
|
||||||
|
print $line->qty;
|
||||||
|
}
|
||||||
print '<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.'" value="'.$line->id.'">';
|
print '<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.'" value="'.$line->id.'">';
|
||||||
print '<input type="hidden" name="pul'.$indiceAsked.'" value="'.$line->pu_ht.'">';
|
print '<input type="hidden" name="pul'.$indiceAsked.'" value="'.$line->pu_ht.'">';
|
||||||
print '<input name="qtyasked'.$indiceAsked.'" id="qtyasked'.$indiceAsked.'" type="hidden" value="'.$line->qty.'">';
|
print '<input name="qtyasked'.$indiceAsked.'" id="qtyasked'.$indiceAsked.'" type="hidden" value="'.$line->qty.'">';
|
||||||
@ -1121,7 +1134,9 @@ if ($action == 'create') {
|
|||||||
// Qty already received
|
// Qty already received
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
$quantityDelivered = $objectsrc->receptions[$line->id];
|
$quantityDelivered = $objectsrc->receptions[$line->id];
|
||||||
print $quantityDelivered;
|
if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice
|
||||||
|
print $quantityDelivered;
|
||||||
|
}
|
||||||
print '<input name="qtydelivered'.$indiceAsked.'" id="qtydelivered'.$indiceAsked.'" type="hidden" value="'.$quantityDelivered.'">';
|
print '<input name="qtydelivered'.$indiceAsked.'" id="qtydelivered'.$indiceAsked.'" type="hidden" value="'.$quantityDelivered.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -1190,6 +1205,9 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$arrayofpurchaselinealreadyoutput[$line->id] = $line->id;
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$extralabelslines = $extrafields->attributes[$line->table_element];
|
$extralabelslines = $extrafields->attributes[$line->table_element];
|
||||||
@ -1756,7 +1774,9 @@ if ($action == 'create') {
|
|||||||
//var_dump($alreadysent);
|
//var_dump($alreadysent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop on each product to send/sent
|
$arrayofpurchaselinealreadyoutput = array();
|
||||||
|
|
||||||
|
// Loop on each product to send/sent. Warning: $lines must be sorted by ->fk_commandefourndet (it is a regroupment key on output)
|
||||||
for ($i = 0; $i < $num_prod; $i++) {
|
for ($i = 0; $i < $num_prod; $i++) {
|
||||||
print '<!-- origin line id = '.$lines[$i]->origin_line_id.' -->'; // id of order line
|
print '<!-- origin line id = '.$lines[$i]->origin_line_id.' -->'; // id of order line
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -1778,32 +1798,35 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
|
||||||
$text = $lines[$i]->product->getNomUrl(1);
|
$text = $lines[$i]->product->getNomUrl(1);
|
||||||
$text .= ' - '.$label;
|
$text .= ' - '.$label;
|
||||||
$description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($lines[$i]->product->description));
|
$description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($lines[$i]->product->description));
|
||||||
print $form->textwithtooltip($text, $description, 3, '', '', $i);
|
print $form->textwithtooltip($text, $description, 3, '', '', $i);
|
||||||
print_date_range($lines[$i]->date_start, $lines[$i]->date_end);
|
print_date_range($lines[$i]->date_start, $lines[$i]->date_end);
|
||||||
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
|
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
|
||||||
print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ? '<br>'.dol_htmlentitiesbr($lines[$i]->description) : '';
|
print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ? '<br>'.dol_htmlentitiesbr($lines[$i]->description) : '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
} else {
|
} else {
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if ($lines[$i]->product_type == Product::TYPE_SERVICE) {
|
if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
|
||||||
$text = img_object($langs->trans('Service'), 'service');
|
if ($lines[$i]->product_type == Product::TYPE_SERVICE) {
|
||||||
} else {
|
$text = img_object($langs->trans('Service'), 'service');
|
||||||
$text = img_object($langs->trans('Product'), 'product');
|
} else {
|
||||||
}
|
$text = img_object($langs->trans('Product'), 'product');
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($lines[$i]->label)) {
|
if (!empty($lines[$i]->label)) {
|
||||||
$text .= ' <strong>'.$lines[$i]->label.'</strong>';
|
$text .= ' <strong>'.$lines[$i]->label.'</strong>';
|
||||||
print $form->textwithtooltip($text, $lines[$i]->description, 3, '', '', $i);
|
print $form->textwithtooltip($text, $lines[$i]->description, 3, '', '', $i);
|
||||||
} else {
|
} else {
|
||||||
print $text.' '.nl2br($lines[$i]->description);
|
print $text.' '.nl2br($lines[$i]->description);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_date_range($lines[$i]->date_start, $lines[$i]->date_end);
|
print_date_range($lines[$i]->date_start, $lines[$i]->date_end);
|
||||||
|
}
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1815,33 +1838,39 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
|
|
||||||
// Qty ordered
|
// Qty ordered
|
||||||
print '<td class="center">'.$lines[$i]->qty_asked.'</td>';
|
print '<td class="center">';
|
||||||
|
if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
|
||||||
|
print $lines[$i]->qty_asked;
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Qty in other receptions (with reception and warehouse used)
|
// Qty in other receptions (with reception and warehouse used)
|
||||||
if ($origin && $origin_id > 0) {
|
if ($origin && $origin_id > 0) {
|
||||||
print '<td class="center nowrap">';
|
print '<td class="center nowrap">';
|
||||||
foreach ($alreadysent as $key => $val) {
|
if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
|
||||||
if ($lines[$i]->fk_commandefourndet == $key) {
|
foreach ($alreadysent as $key => $val) {
|
||||||
$j = 0;
|
if ($lines[$i]->fk_commandefourndet == $key) {
|
||||||
foreach ($val as $receptionline_id => $receptionline_var) {
|
$j = 0;
|
||||||
if ($receptionline_var['reception_id'] == $lines[$i]->fk_reception) {
|
foreach ($val as $receptionline_id => $receptionline_var) {
|
||||||
continue; // We want to show only "other receptions"
|
if ($receptionline_var['reception_id'] == $lines[$i]->fk_reception) {
|
||||||
}
|
continue; // We want to show only "other receptions"
|
||||||
|
}
|
||||||
|
|
||||||
$j++;
|
$j++;
|
||||||
if ($j > 1) {
|
if ($j > 1) {
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
$reception_static->fetch($receptionline_var['reception_id']);
|
$reception_static->fetch($receptionline_var['reception_id']);
|
||||||
print $reception_static->getNomUrl(1);
|
print $reception_static->getNomUrl(1);
|
||||||
print ' - '.$receptionline_var['qty'];
|
print ' - '.$receptionline_var['qty'];
|
||||||
|
|
||||||
$htmltext = $langs->trans("DateValidation").' : '.(empty($receptionline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($receptionline_var['date_valid'], 'dayhour'));
|
$htmltext = $langs->trans("DateValidation").' : '.(empty($receptionline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($receptionline_var['date_valid'], 'dayhour'));
|
||||||
if (!empty($conf->stock->enabled) && $receptionline_var['warehouse'] > 0) {
|
if (!empty($conf->stock->enabled) && $receptionline_var['warehouse'] > 0) {
|
||||||
$warehousestatic->fetch($receptionline_var['warehouse']);
|
$warehousestatic->fetch($receptionline_var['warehouse']);
|
||||||
$htmltext .= '<br>'.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1, '', 0, 1);
|
$htmltext .= '<br>'.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1, '', 0, 1);
|
||||||
|
}
|
||||||
|
print ' '.$form->textwithpicto('', $htmltext, 1);
|
||||||
}
|
}
|
||||||
print ' '.$form->textwithpicto('', $htmltext, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1971,6 +2000,8 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
|
$arrayofpurchaselinealreadyoutput[$lines[$i]->fk_commandefourndet] = $lines[$i]->fk_commandefourndet;
|
||||||
|
|
||||||
// Display lines extrafields
|
// Display lines extrafields
|
||||||
$extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
|
$extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
|
||||||
if (is_array($extralabelslines) && count($extralabelslines) > 0) {
|
if (is_array($extralabelslines) && count($extralabelslines) > 0) {
|
||||||
|
|||||||
@ -875,8 +875,8 @@ class Societe extends CommonObject
|
|||||||
$sql .= ", name_alias";
|
$sql .= ", name_alias";
|
||||||
$sql .= ", entity";
|
$sql .= ", entity";
|
||||||
$sql .= ", datec";
|
$sql .= ", datec";
|
||||||
$sql .= ", fk_typent";
|
|
||||||
$sql .= ", fk_user_creat";
|
$sql .= ", fk_user_creat";
|
||||||
|
$sql .= ", fk_typent";
|
||||||
$sql .= ", canvas";
|
$sql .= ", canvas";
|
||||||
$sql .= ", status";
|
$sql .= ", status";
|
||||||
$sql .= ", ref_ext";
|
$sql .= ", ref_ext";
|
||||||
|
|||||||
@ -391,7 +391,7 @@ foreach ($search as $key => $val) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||||
if ($search[$key] != '') {
|
if ($search[$key] != '' && !is_array($val)) {
|
||||||
$sql .= natural_search($key, $search[$key], $mode_search);
|
$sql .= natural_search($key, $search[$key], $mode_search);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -609,9 +609,9 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
|||||||
$param .= '&limit='.urlencode($limit);
|
$param .= '&limit='.urlencode($limit);
|
||||||
}
|
}
|
||||||
foreach ($search as $key => $val) {
|
foreach ($search as $key => $val) {
|
||||||
if (is_array($search[$key]) && count($search[$key])) {
|
if (is_array($val) && count($val)) {
|
||||||
foreach ($search[$key] as $skey) {
|
foreach ($val as $skey) {
|
||||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
$param .= (!empty($val)) ? '&search_'.$key.'[]='.urlencode($skey) : "";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||||
|
|||||||
@ -207,6 +207,9 @@ if (!empty($conf->adherent->enabled)) {
|
|||||||
if (!empty($conf->agenda->enabled)) {
|
if (!empty($conf->agenda->enabled)) {
|
||||||
$tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda';
|
$tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda';
|
||||||
}
|
}
|
||||||
|
if (!empty($conf->ticket->enabled)) {
|
||||||
|
$tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = 'Tickets';
|
||||||
|
}
|
||||||
|
|
||||||
$head = user_prepare_head($object);
|
$head = user_prepare_head($object);
|
||||||
|
|
||||||
|
|||||||
@ -248,7 +248,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST(
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$prodcomb->variation_weight = $weight_impact;
|
$prodcomb->variation_weight = price2num($weight_impact);
|
||||||
|
|
||||||
// for conf PRODUIT_MULTIPRICES
|
// for conf PRODUIT_MULTIPRICES
|
||||||
if ($conf->global->PRODUIT_MULTIPRICES) {
|
if ($conf->global->PRODUIT_MULTIPRICES) {
|
||||||
|
|||||||
@ -359,7 +359,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
|||||||
$_POST['param8b']='<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag
|
$_POST['param8b']='<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag
|
||||||
$_POST['param8c']='< with space after is ok';
|
$_POST['param8c']='< with space after is ok';
|
||||||
$_POST['param8d']='<abc123 is html to clean';
|
$_POST['param8d']='<abc123 is html to clean';
|
||||||
$_POST['param8e']='<123abc is not html to clean';
|
$_POST['param8e']='<123abc is not html to clean'; // other similar case: '<2021-12-12'
|
||||||
$_POST['param8f']='abc<<svg <><<animate onbegin=alert(document.domain) a';
|
$_POST['param8f']='abc<<svg <><<animate onbegin=alert(document.domain) a';
|
||||||
$_POST["param9"]='is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'objnotdefined\'';
|
$_POST["param9"]='is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'objnotdefined\'';
|
||||||
$_POST["param10"]='is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'<abc>objnotdefined\'';
|
$_POST["param10"]='is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'<abc>objnotdefined\'';
|
||||||
@ -501,6 +501,10 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
|||||||
print __METHOD__." result param7 = ".$result."\n";
|
print __METHOD__." result param7 = ".$result."\n";
|
||||||
$this->assertEquals('"c:\this is a path~1\aaan &#x;;;;" abcdef', $result);
|
$this->assertEquals('"c:\this is a path~1\aaan &#x;;;;" abcdef', $result);
|
||||||
|
|
||||||
|
$result=GETPOST("param8e", 'restricthtml');
|
||||||
|
print __METHOD__." result param8e = ".$result."\n";
|
||||||
|
$this->assertEquals('', $result);
|
||||||
|
|
||||||
$result=GETPOST("param12", 'restricthtml');
|
$result=GETPOST("param12", 'restricthtml');
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals(trim($_POST["param12"]), $result, 'Test a string with DOCTYPE and restricthtml');
|
$this->assertEquals(trim($_POST["param12"]), $result, 'Test a string with DOCTYPE and restricthtml');
|
||||||
@ -519,7 +523,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
|||||||
|
|
||||||
$result=GETPOST("param15", 'restricthtml'); // <img onerror<=alert(document.domain)> src=>0xbeefed
|
$result=GETPOST("param15", 'restricthtml'); // <img onerror<=alert(document.domain)> src=>0xbeefed
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15a'); // The GETPOST return a harmull string
|
$this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15'); // The GETPOST return a harmull string
|
||||||
|
|
||||||
// Test with restricthtml + MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES to test disabling of bad atrributes
|
// Test with restricthtml + MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES to test disabling of bad atrributes
|
||||||
$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1;
|
$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user