Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
9a3d8022f3
@ -55,8 +55,8 @@ class AccountancyImport
|
||||
$fieldname = $fieldArr[1];
|
||||
}
|
||||
|
||||
$debit = trim($arrayrecord[11]['val']);
|
||||
$credit = trim($arrayrecord[12]['val']);
|
||||
$debit = floatval(trim($arrayrecord[11]['val']));
|
||||
$credit = floatval(trim($arrayrecord[12]['val']));
|
||||
if (!empty($debit)) {
|
||||
$amount = $debit;
|
||||
} else {
|
||||
@ -86,7 +86,7 @@ class AccountancyImport
|
||||
$fieldname = $fieldArr[1];
|
||||
}
|
||||
|
||||
$debit = trim($arrayrecord[11]['val']);
|
||||
$debit = floatval(trim($arrayrecord[11]['val']));
|
||||
if (!empty($debit)) {
|
||||
$sens = 'D';
|
||||
} else {
|
||||
|
||||
@ -331,7 +331,7 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->piece_num)) {
|
||||
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
||||
$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);
|
||||
if ($resqlnum) {
|
||||
@ -745,7 +745,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.date_validated as date_validation";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t';
|
||||
$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) {
|
||||
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
|
||||
} else {
|
||||
@ -890,7 +890,7 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$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) {
|
||||
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
|
||||
}
|
||||
@ -1046,7 +1046,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) {
|
||||
$sql .= " AND t.date_export IS NULL";
|
||||
}
|
||||
@ -1166,7 +1166,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) {
|
||||
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
|
||||
}
|
||||
@ -1464,7 +1464,7 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0)
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
if (empty($delyear) && empty($journal)) {
|
||||
$this->error = 'ErrorOneFieldRequired';
|
||||
@ -1485,7 +1485,7 @@ class BookKeeping extends CommonObject
|
||||
if (!empty($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
|
||||
$sql .= " AND date_validated IS NULL";
|
||||
|
||||
@ -1524,7 +1524,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$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 entity IN (".getEntity('accountancy').")";
|
||||
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -1646,7 +1646,7 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||
$sql .= " WHERE piece_num = ".((int) $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);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1684,9 +1684,10 @@ class BookKeeping extends CommonObject
|
||||
global $conf;
|
||||
|
||||
$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", LOG_DEBUG);
|
||||
|
||||
dol_syslog(get_class($this)."getNextNumMvt", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
@ -1727,7 +1728,7 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||
$sql .= " WHERE piece_num = ".((int) $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);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1790,7 +1791,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,";
|
||||
$sql .= " date_validated as date_validation";
|
||||
$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);
|
||||
|
||||
@ -1846,6 +1847,8 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public function transformTransaction($direction = 0, $piece_num = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
@ -1865,14 +1868,14 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
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);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
@ -1880,7 +1883,7 @@ class BookKeeping extends CommonObject
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
} 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);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
@ -1895,14 +1898,14 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$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);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
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);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
@ -1957,7 +1960,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " AND aa.active = 1";
|
||||
$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 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";
|
||||
|
||||
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
|
||||
@ -2021,7 +2024,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 root ON parent.account_parent = root.rowid AND root.active = 1";
|
||||
$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", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -2061,7 +2064,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " AND asy.rowid = ".((int) $pcgver);
|
||||
$sql .= " AND aa.active = 1";
|
||||
$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", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -238,7 +238,14 @@ if ($id > 0 || $ref) {
|
||||
$modulepart = 'paymentbybanktransfer';
|
||||
}
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -455,7 +455,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$_SERVER["PHP_SELF"],
|
||||
"amount",
|
||||
"",
|
||||
$classslink,
|
||||
$paramslink,
|
||||
'class="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
|
||||
@ -1558,7 +1558,7 @@ class ExtraFields
|
||||
} elseif ($type == 'price') {
|
||||
//$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
|
||||
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') {
|
||||
$valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : '');
|
||||
|
||||
@ -736,6 +736,29 @@ class ImportCsv extends ModeleImports
|
||||
$tmp = explode('-', $val, 2);
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
$listvalues[] = "'".$this->db->escape($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 {
|
||||
$this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden';
|
||||
$this->errors[$error]['type'] = 'Import profile setup';
|
||||
|
||||
@ -776,7 +776,30 @@ class ImportXlsx extends ModeleImports
|
||||
} elseif (preg_match('/^const-/', $val)) {
|
||||
$tmp = explode('-', $val, 2);
|
||||
$listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
|
||||
$listvalues[] = "'" . $this->db->escape($tmp[1]) . "'";
|
||||
$listvalues[] = "'".$this->db->escape($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 {
|
||||
$this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden';
|
||||
$this->errors[$error]['type'] = 'Import profile setup';
|
||||
|
||||
@ -1532,9 +1532,7 @@ if ($resql) {
|
||||
$projectstatic = new Project($db);
|
||||
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$totalarray['val'] = array();
|
||||
$totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array());
|
||||
$totalarray['val']['cf.total_ht'] = 0;
|
||||
$totalarray['val']['cf.total_ttc'] = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
|
||||
@ -109,7 +109,7 @@ class Position extends CommonObject
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
|
||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
|
||||
'fk_contrat' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'fk_contrat', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>0,),
|
||||
'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>1,),
|
||||
'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'default'=>0),
|
||||
'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,),
|
||||
'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,),
|
||||
'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,),
|
||||
@ -843,6 +843,77 @@ class Position extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML string to put an input field into a page
|
||||
* Code very similar with showInputField of extra fields
|
||||
*
|
||||
* @param array $val Array of properties for field to show
|
||||
* @param string $key Key of attribute
|
||||
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
|
||||
* @param string $moreparam To add more parameters on html input tag
|
||||
* @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param string|int $morecss Value for css to define style/length of field. May also be a numeric.
|
||||
* @param int $nonewbutton Do not show new button
|
||||
* @return string
|
||||
*/
|
||||
public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($key == 'fk_user') {
|
||||
$vacantId = $keyprefix.$key.'vacant'.$keysuffix;
|
||||
|
||||
$out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
|
||||
$out .= '<label class="nowrap position-fk-user classfortooltip" title="'.dol_escape_js($langs->trans('VacantCheckboxHelper')).'"><input type="checkbox" id="'.$vacantId.'" name="'.$vacantId.'" /> '.$langs->trans("Vacant").'</label>';
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
var checkbox = $('#<?php print $vacantId; ?>');
|
||||
var searchfkuser = $('#<?php print $keyprefix.$key.$keysuffix; ?>');
|
||||
checkbox.click(function () {
|
||||
if (checkbox.prop('checked')) {
|
||||
searchfkuser.val(0).trigger('change');
|
||||
searchfkuser.prop('disabled', 1);
|
||||
} else {
|
||||
searchfkuser.prop('disabled', 0);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
$out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML string to show a field into a page
|
||||
* Code very similar with showOutputField of extra fields
|
||||
*
|
||||
* @param array $val Array of properties of field to show
|
||||
* @param string $key Key of attribute
|
||||
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
|
||||
* @param string $moreparam To add more parametes on html input tag
|
||||
* @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param mixed $morecss Value for css to define size. May also be a numeric.
|
||||
* @return string
|
||||
*/
|
||||
public function showOutputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($key == 'fk_user' && $this->fk_user == 0) {
|
||||
return $langs->trans("VacantPosition");
|
||||
}
|
||||
return parent::showOutputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the info information in the object
|
||||
*
|
||||
* @param int $id Id of object
|
||||
@ -1072,7 +1143,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php';
|
||||
class PositionLine extends CommonObjectLine
|
||||
{
|
||||
// To complete with content of an object PositionLine
|
||||
// We should have a field rowid, fk_position and position
|
||||
// We should have a field rowid , fk_position and position
|
||||
|
||||
/**
|
||||
* @var int Does object support extrafields ? 0=No, 1=Yes
|
||||
|
||||
@ -270,6 +270,10 @@ foreach ($search as $key => $val) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$vacant = GETPOST('search_fk_uservacant', 'alphanohtml') === 'on';
|
||||
if ($vacant) {
|
||||
$sql .= ' AND t.fk_user = 0';
|
||||
}
|
||||
if ($search_all) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
}
|
||||
|
||||
@ -141,6 +141,7 @@ $endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : '');
|
||||
$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 : ','));
|
||||
$enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"');
|
||||
$separator_used = str_replace('\t', "\t", $separator);
|
||||
|
||||
$objimport = new Import($db);
|
||||
$objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport));
|
||||
@ -773,7 +774,7 @@ if ($step == 4 && $datatoimport) {
|
||||
require_once $dir.$file;
|
||||
$obj = new $classname($db, $datatoimport);
|
||||
if ($model == 'csv') {
|
||||
$obj->separator = $separator;
|
||||
$obj->separator = $separator_used;
|
||||
$obj->enclosure = $enclosure;
|
||||
}
|
||||
if ($model == 'xlsx') {
|
||||
@ -1334,7 +1335,7 @@ if ($step == 5 && $datatoimport) {
|
||||
require_once $dir.$file;
|
||||
$obj = new $classname($db, $datatoimport);
|
||||
if ($model == 'csv') {
|
||||
$obj->separator = $separator;
|
||||
$obj->separator = $separator_used;
|
||||
$obj->enclosure = $enclosure;
|
||||
}
|
||||
|
||||
@ -1783,7 +1784,7 @@ if ($step == 6 && $datatoimport) {
|
||||
require_once $dir.$file;
|
||||
$obj = new $classname($db, $datatoimport);
|
||||
if ($model == 'csv') {
|
||||
$obj->separator = $separator;
|
||||
$obj->separator = $separator_used;
|
||||
$obj->enclosure = $enclosure;
|
||||
}
|
||||
|
||||
|
||||
@ -79,3 +79,6 @@ NoEval=No evaluation done for this employee
|
||||
HowManyUserWithThisMaxNote=Number of users with this rank
|
||||
HighestRank=Highest rank
|
||||
SkillComparison=Skill comparison
|
||||
ActionsOnJob=Events on this job
|
||||
VacantPosition=job vacancy
|
||||
VacantCheckboxHelper=Checking this option will show unfilled positions (job vacancy)
|
||||
|
||||
@ -79,4 +79,6 @@ NoEval=Aucune évaluation effectuée pour cet employé
|
||||
HowManyUserWithThisMaxNote=Nombre d'employés avec ce niveau
|
||||
HighestRank=Plus haut niveau
|
||||
SkillComparison=Comparaison des compétences
|
||||
ActionsOnJob=Événements sur cet emploi
|
||||
ActionsOnJob=Événements sur cet emploi
|
||||
VacantPosition=Poste vacant
|
||||
VacantCheckboxHelper=Cocher cette option affichera le(s) poste(s) comme non pourvu(s)
|
||||
|
||||
@ -618,6 +618,11 @@ if ($id > 0) {
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -54,6 +54,9 @@ if ($result <= 0) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('surveycard', 'globalcard'));
|
||||
|
||||
$expiredate = dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear'));
|
||||
|
||||
|
||||
@ -338,6 +341,11 @@ if ($action != 'edit') {
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -207,6 +207,9 @@ if (!empty($conf->adherent->enabled)) {
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
$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);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user