Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 15.0

This commit is contained in:
Laurent Destailleur 2022-02-18 21:52:18 +01:00
commit bd58cf1b37
7 changed files with 103 additions and 4 deletions

View File

@ -238,7 +238,14 @@ if ($id > 0 || $ref) {
$modulepart = 'paymentbybanktransfer';
}
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart='.$modulepart.'&amp;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>';

View File

@ -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,76 @@ 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.
* @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.'" />&nbsp;'.$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 +1142,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

View File

@ -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);
}

View File

@ -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)

View File

@ -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)

View File

@ -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>';

View File

@ -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>';