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

This commit is contained in:
Laurent Destailleur 2021-07-26 00:41:35 +02:00
commit 079b014b14
18 changed files with 131 additions and 81 deletions

View File

@ -2340,7 +2340,7 @@ class ActionComm extends CommonObject
$sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray);
//Topic
$sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->trans('EventReminder'));
$sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder'));
// Recipient
$recipient = new User($this->db);

View File

@ -47,7 +47,7 @@ $massaction = GETPOST('massaction', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
$resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid", "int") : GETPOST("resourceid", "int");
$pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3);
$search_status = (GETPOST("search_status", 'alpha') != '') ?GETPOST("search_status", 'alpha') : GETPOST("status", 'alpha');
$search_status = (GETPOST("search_status", 'aZ09') != '') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09');
$type = GETPOST('search_type', 'alphanohtml') ?GETPOST('search_type', 'alphanohtml') : GETPOST('type', 'alphanohtml');
$optioncss = GETPOST('optioncss', 'alpha');
$year = GETPOST("year", 'int');

View File

@ -1003,7 +1003,7 @@ if ($action == 'create') {
$soc->fetch($socid);
}
if (GETPOST('origin') && GETPOST('originid')) {
if (GETPOST('origin') && GETPOST('originid', 'int')) {
// Parse element/subelement (ex: project_task)
$regs = array();
$element = $subelement = GETPOST('origin');
@ -1013,7 +1013,7 @@ if ($action == 'create') {
}
if ($element == 'project') {
$projectid = GETPOST('originid');
$projectid = GETPOST('originid', 'int');
} else {
// For compatibility
if ($element == 'order' || $element == 'commande') {
@ -1094,7 +1094,8 @@ if ($action == 'create') {
print '</td>';
} else {
print '<td>';
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300');
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td>';
}
@ -1121,11 +1122,13 @@ if ($action == 'create') {
// Commercial suivi
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").'</span></td><td>';
print img_picto('', 'user', 'class="pictofixedwidth"');
print $form->select_dolusers(GETPOST("commercial_suivi_id") ?GETPOST("commercial_suivi_id") : $user->id, 'commercial_suivi_id', 1, '');
print '</td></tr>';
// Commercial signature
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").'</span></td><td>';
print img_picto('', 'user', 'class="pictofixedwidth"');
print $form->select_dolusers(GETPOST("commercial_signature_id") ?GETPOST("commercial_signature_id") : $user->id, 'commercial_signature_id', 1, '');
print '</td></tr>';
@ -1686,7 +1689,7 @@ if ($action == 'create') {
$colspan++;
}
// Ligne dates prevues
// Line dates planed
print '<tr class="oddeven">';
print '<td colspan="'.$colspan.'">';
print $langs->trans("DateStartPlanned").' ';
@ -1786,7 +1789,7 @@ if ($action == 'create') {
print '<table class="notopnoleftnoright tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
print '<tr class="oddeven" '.$moreparam.'>';
print '<td>'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline - 1]->getLibStatut(4).'</td>';
print '<td><span class="valignmiddle hideonsmartphone">'.$langs->trans("ServiceStatus").':</span> '.$object->lines[$cursorline - 1]->getLibStatut(4).'</td>';
print '<td width="30" class="right">';
if ($user->socid == 0) {
if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline') {

View File

@ -97,7 +97,7 @@ class FormActions
function select_status() {
var defaultvalue = $('#select' + htmlname).val();
var percentage = $('input[name=percentage]');
var selected = '".(isset($selected) ? $selected : '')."';
var selected = '".(isset($selected) ? dol_escape_js($selected) : '')."';
var value = (selected>0?selected:(defaultvalue>=0?defaultvalue:''));
percentage.val(value);

View File

@ -131,8 +131,8 @@ function check_events() {
if (value.type == 'agenda')
{
url = '<?php print DOL_URL_ROOT.'/comm/action/card.php?id='; ?>' + value.id_agenda;
title = '<?php print dol_escape_js($langs->trans('EventReminder')) ?>';
url = '<?php print DOL_URL_ROOT.'/comm/action/card.php?id='; ?>' + value.id_agenda;
title = '<?php print dol_escape_js($langs->transnoentities('EventReminder')) ?>';
}
var extra = {
icon: '<?php print DOL_URL_ROOT.'/theme/common/bell.png'; ?>',

View File

@ -61,13 +61,13 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
// Filters
//print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="get">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="year" value="'.$year.'">';
print '<input type="hidden" name="month" value="'.$month.'">';
print '<input type="hidden" name="day" value="'.$day.'">';
print '<input type="hidden" name="year" value="'.((int) $year).'">';
print '<input type="hidden" name="month" value="'.((int) $month).'">';
print '<input type="hidden" name="day" value="'.((int) $day).'">';
if ($massaction != 'predelete' && $massaction != 'preaffecttag') { // When $massaction == 'predelete', action may be already output to 'delete' by the mass action system.
print '<input type="hidden" name="action" value="'.$action.'">';
}
print '<input type="hidden" name="search_showbirthday" value="'.$showbirthday.'">';
print '<input type="hidden" name="search_showbirthday" value="'.((int) $showbirthday).'">';
if ($canedit) {
print '<div class="divsearchfield">';

View File

@ -1948,7 +1948,9 @@ function show_subsidiaries($conf, $langs, $db, $object)
$socstatic = new Societe($db);
print load_fiche_titre($langs->trans("Subsidiaries"), '', '');
print "\n".'<table class="noborder centpercent">'."\n";
print "\n".'<div class="div-table-responsive-no-min">'."\n";
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre"><td>'.$langs->trans("Company").'</td>';
print '<td>'.$langs->trans("Address").'</td><td>'.$langs->trans("Zip").'</td>';
@ -1976,17 +1978,17 @@ function show_subsidiaries($conf, $langs, $db, $object)
print '<tr class="oddeven">';
print '<td>';
print '<td class="tdoverflowmax150">';
print $socstatic->getNomUrl(1);
print '</td>';
print '<td>'.$obj->address.'</td>';
print '<td>'.$obj->zip.'</td>';
print '<td>'.$obj->town.'</td>';
print '<td>'.$obj->code_client.'</td>';
print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->address).'">'.dol_escape_htmltag($obj->address).'</td>';
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).'">'.$obj->zip.'</td>';
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->town).'">'.$obj->town.'</td>';
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->code_client).'">'.$obj->code_client.'</td>';
print '<td class="center">';
print '<a href="'.DOL_URL_ROOT.'/societe/card.php?socid='.$obj->rowid.'&amp;action=edit">';
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/societe/card.php?socid='.((int) $obj->rowid).'&action=edit">';
print img_edit();
print '</a></td>';
@ -1994,6 +1996,7 @@ function show_subsidiaries($conf, $langs, $db, $object)
$i++;
}
print "\n</table>\n";
print '</div>'."\n";
}
print "<br>\n";

View File

@ -138,7 +138,7 @@ abstract class ModeleNumRefBarCode
{
global $conf;
$langs->load("admin");
$langs->loadLangs(array("admin", "companies"));
$s = '';
$s .= $langs->trans("Name").': <b>'.$this->name.'</b><br>';

View File

@ -118,7 +118,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("ProductCodeModel").'):</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.(!empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT) ? $conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT : '').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"'.$disabled.'></td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button small" value="'.$langs->trans("Modify").'" name="Button"'.$disabled.'></td>';
$texte .= '</tr>';

View File

@ -193,7 +193,8 @@ abstract class ModeleProductCode
{
global $conf;
$langs->load("admin");
$langs->loadLangs(array("admin", "companies"));
$strikestart = '';
$strikeend = '';
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) {

View File

@ -198,7 +198,8 @@ abstract class ModeleThirdPartyCode
{
global $conf;
$langs->load("admin");
$langs->loadLangs(array("admin", "companies"));
$strikestart = '';
$strikeend = '';
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) {

View File

@ -1296,11 +1296,11 @@ class Holiday extends CommonObject
*
* @param int $selected Id of preselected status
* @param string $htmlname Name of HTML select field
* @param string $morecss More CSS on select component
* @return string Show select of status
*/
public function selectStatutCP($selected = '', $htmlname = 'select_statut')
public function selectStatutCP($selected = '', $htmlname = 'select_statut', $morecss = 'minwidth125')
{
global $langs;
// Liste des statuts
@ -1308,7 +1308,7 @@ class Holiday extends CommonObject
$nb = count($name) + 1;
// Select HTML
$out = '<select name="'.$htmlname.'" id="'.$htmlname.'" class="flat">'."\n";
$out = '<select name="'.$htmlname.'" id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'">'."\n";
$out .= '<option value="-1">&nbsp;</option>'."\n";
// Boucle des statuts

View File

@ -636,7 +636,7 @@ if ($resql) {
// Create date
if (!empty($arrayfields['cp.date_create']['checked'])) {
print '<td class="liste_titre center nowraponall">';
print '<td class="liste_titre center width200">';
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_create" value="'.dol_escape_htmltag($search_month_create).'">';
$formother->select_year($search_year_create, 'search_year_create', 1, $min_year, 0);
print '</td>';
@ -644,7 +644,7 @@ if ($resql) {
// Create date
if (!empty($arrayfields['cp.tms']['checked'])) {
print '<td class="liste_titre center nowraponall">';
print '<td class="liste_titre center width200">';
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_update" value="'.dol_escape_htmltag($search_month_update).'">';
$formother->select_year($search_year_update, 'search_year_update', 1, $min_year, 0);
print '</td>';
@ -652,8 +652,8 @@ if ($resql) {
// Status
if (!empty($arrayfields['cp.statut']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone maxwidth200 right">';
$object->selectStatutCP($search_status, 'search_status');
print '<td class="liste_titre right">';
$object->selectStatutCP($search_status, 'search_status', 'minwidth125');
print '</td>';
}
@ -781,7 +781,7 @@ if ($resql) {
}
}
if (!empty($arrayfields['cp.fk_type']['checked'])) {
print '<td>';
print '<td class="minwidth100">';
$labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']);
print empty($typeleaves[$obj->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow;
print '</td>';

View File

@ -327,22 +327,21 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objec
$sql .= $hookmanager->resPrint;
/* If a group by is required
$sql.= " GROUP BY ";
foreach($object->fields as $key => $val)
{
$sql.='t.'.$key.', ';
$sql .= " GROUP BY ";
foreach($object->fields as $key => $val) {
$sql .= 't.'.$key.', ';
}
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
}
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/,\s*$/','', $sql);
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
*/
$sql .= $db->order($sortfield, $sortorder);

View File

@ -295,13 +295,14 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
print load_fiche_titre($langs->trans("ProductCodeChecker"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">'."\n";
print ' <td>'.$langs->trans("Name").'</td>';
print ' <td>'.$langs->trans("Description").'</td>';
print ' <td>'.$langs->trans("Example").'</td>';
print ' <td class="center" width="80">'.$langs->trans("Status").'</td>';
print ' <td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
print ' <td class="center"></td>';
print "</tr>\n";
foreach ($dirproduct as $dirroot) {
@ -333,7 +334,7 @@ foreach ($dirproduct as $dirroot) {
print '<tr class="oddeven">'."\n";
print '<td width="140">'.$modCodeProduct->name.'</td>'."\n";
print '<td>'.$modCodeProduct->info($langs).'</td>'."\n";
print '<td class="nowrap">'.$modCodeProduct->getExample($langs).'</td>'."\n";
print '<td class="nowrap"><span class="opacitymedium">'.$modCodeProduct->getExample($langs).'</span></td>'."\n";
if (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) && $conf->global->PRODUCT_CODEPRODUCT_ADDON == $file) {
print '<td class="center">'."\n";
@ -366,6 +367,7 @@ foreach ($dirproduct as $dirroot) {
}
}
print '</table>';
print '</div>';
// Module to build doc
$def = array();
@ -390,13 +392,14 @@ print '<br>';
print load_fiche_titre($langs->trans("ProductDocumentTemplates"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td class="center" width="80">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center"></td>';
print '<td class="center" width="80">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
@ -499,6 +502,8 @@ foreach ($dirmodels as $reldir) {
}
print '</table>';
print '</div>';
print "<br>";
/*
@ -517,6 +522,7 @@ print '<input type="hidden" name="page_y" value="">';
print load_fiche_titre($langs->trans("ProductOtherConf"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
@ -611,6 +617,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
}
print '</table>';
print '</div>';
print '<div class="center">';
print '<input type="submit" class="button reposition" value="'.$langs->trans("Modify").'">';
@ -620,6 +627,7 @@ print '</div>';
print load_fiche_titre($langs->trans("UserInterface"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
@ -671,7 +679,7 @@ print $form->selectarray(
0,
0,
'',
'maxwidth400',
'minwidth100imp maxwidth400',
1
);
print '</td>';
@ -772,6 +780,7 @@ if (!empty($conf->global->PRODUCT_CANVAS_ABILITY)) {
}
print '</table>';
print '</div>';
print '<div class="center">';
print '<input type="submit" class="button reposition" value="'.$langs->trans("Modify").'">';

View File

@ -101,13 +101,13 @@ class RecruitmentJobPosition extends CommonObject
public $fields = array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'comment'=>"Id"),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object", 'css'=>'nowraponall'),
'label' => array('type'=>'varchar(255)', 'label'=>'JobLabel', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth500', 'csslist'=>'tdoverflowmax300', 'showoncombobox'=>'2', 'autofocusoncreate'=>1),
'qty' => array('type'=>'integer', 'label'=>'NbOfEmployeesExpected', 'enabled'=>'1', 'position'=>45, 'notnull'=>1, 'visible'=>1, 'default'=>'1', 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500', 'picto'=>'project'),
'fk_user_recruiter' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'ResponsibleOfRecruitement', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax150'),
'fk_user_recruiter' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'ResponsibleOfRecruitement', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'),
'email_recruiter' => array('type'=>'varchar(255)', 'label'=>'EmailRecruiter', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>-1, 'help'=>'ToUseAGenericEmail', 'picto'=>'email'),
'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid',),
'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'),
'fk_establishment' => array('type'=>'integer:Establishment:hrm/class/establishment.class.php', 'label'=>'Establishment', 'enabled'=>'$conf->hrm->enabled', 'position'=>56, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'establishment.rowid',),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'1', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'),
'date_planned' => array('type'=>'date', 'label'=>'DateExpected', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,),

View File

@ -103,8 +103,9 @@ $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@ -123,6 +124,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
// Default sort order (if not yet defined by previous GETPOST)
if (!$sortfield) {
reset($object->fields); // Reset is required to avoid key() to return null.
$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
}
if (!$sortorder) {
@ -146,17 +148,18 @@ foreach ($object->fields as $key => $val) {
}
}
// Definition of fields for list
// Definition of array of fields for columns
$arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
$visible = dol_eval($val['visible'], 1);
$visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position']
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
}
}
@ -164,7 +167,7 @@ foreach ($object->fields as $key => $val) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields['nbapplications'] = array('label'=>'Applications', 'checked'=>1, 'enabled'=>1, 'position'=>90);
$arrayfields['nbapplications'] = array('type'=>'integer', 'label'=>'Applications', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
$arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = $user->rights->recruitment->recruitmentjobposition->read;
@ -184,7 +187,8 @@ $result = restrictedArea($user, 'recruitment', 0, 'recruitment_recruitmentjobpos
*/
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
@ -238,13 +242,11 @@ $title = $langs->trans('ListOfPositionsToBeFilled');
// Build and execute select
// --------------------------------------------------------------------
$sql = 'SELECT ';
foreach ($object->fields as $key => $val) {
$sql .= 't.'.$key.', ';
}
$sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : '');
}
}
// Add fields from hooks
@ -258,24 +260,42 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc O
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
if ($object->ismultientitymanaged == 1) {
$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
} else {
$sql .= " WHERE 1 = 1";
}
foreach ($search as $key => $val) {
if ($key == 'status' && $search[$key] == -1) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
if ($search[$key] == '-1') {
$search[$key] = '';
if (array_key_exists($key, $object->fields)) {
if ($key == 'status' && $search[$key] == -1) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
if ($search[$key] == '-1' || $search[$key] === '0') {
$search[$key] = '';
}
$mode_search = 2;
}
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
} else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
}
if (preg_match('/_dtend$/', $key)) {
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
}
}
}
$mode_search = 2;
}
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
}
if ($search_all) {
@ -372,6 +392,10 @@ if ($optioncss != '') {
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(
@ -449,30 +473,38 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']);
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
}
print '</td>';
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
@ -492,14 +524,14 @@ print '</tr>'."\n";
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']);
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
@ -513,7 +545,7 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['nbapplications']['checked'])) {
print '<td class="liste_titre">'.$langs->trans("Applications").'</td>';
print '<td class="liste_titre right">'.$langs->trans("Applications").'</td>';
}
// Action column
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
@ -561,7 +593,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') {
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
@ -570,6 +602,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, '');
} else {
print $object->showOutputField($val, $key, $object->$key, '');
}
@ -602,7 +636,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
}
// Action column
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;

View File

@ -798,7 +798,7 @@ foreach ($object->fields as $key => $val) {
if (!empty($search[$key])) {
$selectedarray = array_values($search[$key]);
}
print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth100 maxwidth150', 1, 0, '', '', '');
print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth100imp maxwidth150', 1, 0, '', '', '');
print '</td>';
} elseif ($key == "fk_soc") {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'"><input type="text" class="flat maxwidth75" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';