End of dev for extrafields on holiday
This commit is contained in:
parent
961f2b5165
commit
b3c49f2ec8
@ -959,9 +959,10 @@ class ExtraFields
|
|||||||
* @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric)
|
* @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric)
|
||||||
* @param int $objectid Current object id
|
* @param int $objectid Current object id
|
||||||
* @param string $extrafieldsobjectkey If defined (for example $object->table_element), use the new method to get extrafields data
|
* @param string $extrafieldsobjectkey If defined (for example $object->table_element), use the new method to get extrafields data
|
||||||
|
* @param string $mode 1=Used for search filters
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '')
|
public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '', $mode = 0)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$form;
|
global $conf,$langs,$form;
|
||||||
|
|
||||||
@ -1115,6 +1116,8 @@ class ExtraFields
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($type == 'boolean')
|
elseif ($type == 'boolean')
|
||||||
|
{
|
||||||
|
if (empty($mode))
|
||||||
{
|
{
|
||||||
$checked='';
|
$checked='';
|
||||||
if (!empty($value)) {
|
if (!empty($value)) {
|
||||||
@ -1124,6 +1127,11 @@ class ExtraFields
|
|||||||
}
|
}
|
||||||
$out='<input type="checkbox" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
$out='<input type="checkbox" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$out.=$form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
elseif ($type == 'price')
|
elseif ($type == 'price')
|
||||||
{
|
{
|
||||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||||
|
|||||||
@ -22,28 +22,28 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
|
|||||||
if (! empty($arrayfields[$extrafieldsobjectprefix.$key]['checked'])) {
|
if (! empty($arrayfields[$extrafieldsobjectprefix.$key]['checked'])) {
|
||||||
$align=$extrafields->getAlignFlag($key);
|
$align=$extrafields->getAlignFlag($key);
|
||||||
$typeofextrafield=$extrafields->attributes[$extrafieldsobjectkey]['type'][$key];
|
$typeofextrafield=$extrafields->attributes[$extrafieldsobjectkey]['type'][$key];
|
||||||
|
|
||||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||||
$tmpkey=preg_replace('/'.$search_options_pattern.'/', '', $key);
|
$tmpkey=preg_replace('/'.$search_options_pattern.'/', '', $key);
|
||||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]))
|
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]))
|
||||||
{
|
{
|
||||||
$crit=$val;
|
|
||||||
$searchclass='';
|
$searchclass='';
|
||||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="'.$search_options_pattern.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options[$search_options_pattern.$tmpkey]).'">';
|
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="'.$search_options_pattern.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options[$search_options_pattern.$tmpkey]).'">';
|
||||||
}
|
}
|
||||||
elseif (! in_array($typeofextrafield, array('datetime','timestamp')))
|
|
||||||
{
|
|
||||||
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
|
|
||||||
$morecss='';
|
|
||||||
if ($typeofextrafield == 'sellist') $morecss='maxwidth200';
|
|
||||||
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss);
|
|
||||||
}
|
|
||||||
elseif (in_array($typeofextrafield, array('datetime','timestamp')))
|
elseif (in_array($typeofextrafield, array('datetime','timestamp')))
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
// Use showInputField in a particular manner to have input with a comparison operator, not input for a specific value date-hour-minutes
|
// Use showInputField in a particular manner to have input with a comparison operator, not input for a specific value date-hour-minutes
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
|
||||||
|
$morecss='';
|
||||||
|
if ($typeofextrafield == 'sellist') $morecss='maxwidth200';
|
||||||
|
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,14 @@ if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array
|
|||||||
{
|
{
|
||||||
$sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'";
|
$sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'";
|
||||||
}
|
}
|
||||||
|
elseif (in_array($typ, array('boolean')))
|
||||||
|
{
|
||||||
|
if ($crit !== '-1' && $crit !== '') {
|
||||||
|
$sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." = '".$db->escape($crit)."'";
|
||||||
|
if ($crit == '0') $sql.=" OR ".$extrafieldsobjectprefix.$tmpkey." IS NULL";
|
||||||
|
$sql.= ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||||
{
|
{
|
||||||
$mode_search=0;
|
$mode_search=0;
|
||||||
|
|||||||
@ -168,7 +168,7 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test must be present to be compatible with all browsers
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
$search_user="";
|
$search_user="";
|
||||||
@ -259,9 +259,9 @@ $title = $langs->trans("ListOfTrips");
|
|||||||
llxHeader('', $title);
|
llxHeader('', $title);
|
||||||
|
|
||||||
$max_year = 5;
|
$max_year = 5;
|
||||||
$min_year = 5;
|
$min_year = 10;
|
||||||
|
|
||||||
// Récupération de l'ID de l'utilisateur
|
// Get current user id
|
||||||
$user_id = $user->id;
|
$user_id = $user->id;
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
@ -805,8 +805,7 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$colspan=1;
|
$colspan=1;
|
||||||
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||||
|
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||||
print '<tr>'.'<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show total line
|
// Show total line
|
||||||
|
|||||||
@ -37,9 +37,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'aZ09');
|
||||||
|
$cancel=GETPOST('cancel', 'alpha');
|
||||||
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
|
|
||||||
$id=GETPOST('id', 'int');
|
$id=GETPOST('id', 'int');
|
||||||
$ref=GETPOST('ref', 'alpha');
|
$ref=GETPOST('ref', 'alpha');
|
||||||
$fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id);
|
$fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id);
|
||||||
@ -48,10 +52,10 @@ $fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id);
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'holiday', $id, 'holiday');
|
$result = restrictedArea($user, 'holiday', $id, 'holiday');
|
||||||
|
|
||||||
$now=dol_now();
|
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->load("holiday");
|
$langs->loadLangs(array("holiday","mails"));
|
||||||
|
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
$childids = $user->getAllChildIds(1);
|
$childids = $user->getAllChildIds(1);
|
||||||
|
|
||||||
@ -61,6 +65,11 @@ if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$object = new Holiday($db);
|
$object = new Holiday($db);
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -83,19 +92,32 @@ $candelete = 0;
|
|||||||
if (! empty($user->rights->holiday->delete)) $candelete=1;
|
if (! empty($user->rights->holiday->delete)) $candelete=1;
|
||||||
if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) $candelete=1;
|
if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) $candelete=1;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel', 'alpha'))
|
$parameters = array('socid' => $socid);
|
||||||
{
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
$action = '';
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
}
|
|
||||||
|
|
||||||
// If create a request
|
if (empty($reshook))
|
||||||
if ($action == 'create')
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if (! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// If create a request
|
||||||
|
if ($action == 'create')
|
||||||
|
{
|
||||||
|
|
||||||
// If no right to create a request
|
// If no right to create a request
|
||||||
if (! $cancreate)
|
if (! $cancreate)
|
||||||
{
|
{
|
||||||
@ -213,10 +235,10 @@ if ($action == 'create')
|
|||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update' && GETPOSTISSET('savevalidator') && ! empty($user->rights->holiday->approve))
|
if ($action == 'update' && GETPOSTISSET('savevalidator') && ! empty($user->rights->holiday->approve))
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
$object->oldcopy = dol_clone($object);
|
$object->oldcopy = dol_clone($object);
|
||||||
@ -240,10 +262,10 @@ if ($action == 'update' && GETPOSTISSET('savevalidator') && ! empty($user->right
|
|||||||
}
|
}
|
||||||
|
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update' && ! GETPOSTISSET('savevalidator'))
|
if ($action == 'update' && ! GETPOSTISSET('savevalidator'))
|
||||||
{
|
{
|
||||||
$date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'));
|
$date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'));
|
||||||
$date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'));
|
$date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'));
|
||||||
$date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1);
|
$date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1);
|
||||||
@ -336,11 +358,11 @@ if ($action == 'update' && ! GETPOSTISSET('savevalidator'))
|
|||||||
setEventMessages($langs->trans("ErrorBadStatus"), null, 'errors');
|
setEventMessages($langs->trans("ErrorBadStatus"), null, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If delete of request
|
// If delete of request
|
||||||
if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights->holiday->delete)
|
if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights->holiday->delete)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -373,11 +395,11 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights-
|
|||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action validate (+ send email for approval)
|
// Action validate (+ send email for approval)
|
||||||
if ($action == 'confirm_send')
|
if ($action == 'confirm_send')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
// Si brouillon et créateur
|
// Si brouillon et créateur
|
||||||
@ -476,12 +498,35 @@ if ($action == 'confirm_send')
|
|||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'update_extras')
|
||||||
|
{
|
||||||
|
$object->oldcopy = dol_clone($object);
|
||||||
|
|
||||||
// Approve leave request
|
// Fill array 'array_options' with data from update form
|
||||||
if ($action == 'confirm_valid')
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
{
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none'));
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
// Actions on extra fields
|
||||||
|
$result = $object->insertExtraFields('HOLIDAY_MODIFY');
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error)
|
||||||
|
$action = 'edit_extras';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Approve leave request
|
||||||
|
if ($action == 'confirm_valid')
|
||||||
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
// Si statut en attente de validation et valideur = utilisateur
|
// Si statut en attente de validation et valideur = utilisateur
|
||||||
@ -589,10 +634,10 @@ if ($action == 'confirm_valid')
|
|||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_refuse' && GETPOST('confirm', 'alpha') == 'yes')
|
if ($action == 'confirm_refuse' && GETPOST('confirm', 'alpha') == 'yes')
|
||||||
{
|
{
|
||||||
if (! empty($_POST['detail_refuse']))
|
if (! empty($_POST['detail_refuse']))
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -686,12 +731,12 @@ if ($action == 'confirm_refuse' && GETPOST('confirm', 'alpha') == 'yes')
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DetailRefusCP")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DetailRefusCP")), null, 'errors');
|
||||||
$action='refuse';
|
$action='refuse';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Si Validation de la demande
|
// Si Validation de la demande
|
||||||
if ($action == 'confirm_draft' && GETPOST('confirm') == 'yes')
|
if ($action == 'confirm_draft' && GETPOST('confirm') == 'yes')
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -717,11 +762,11 @@ if ($action == 'confirm_draft' && GETPOST('confirm') == 'yes')
|
|||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si confirmation of cancellation
|
// Si confirmation of cancellation
|
||||||
if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
|
if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -822,6 +867,23 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Actions when printing a doc from card
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
|
// Actions to send emails
|
||||||
|
$trigger_name='HOLIDAY_SENTBYMAIL';
|
||||||
|
$autocopy='MAIN_MAIL_AUTOCOPY_HOLIDAY_TO';
|
||||||
|
$trackid='leav'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
|
// Actions to build doc
|
||||||
|
$upload_dir = $conf->holiday->dir_output;
|
||||||
|
$permissioncreate = $user->rights->holiday->creer;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1049,6 +1111,9 @@ if ((empty($id) && empty($ref)) || $action == 'add' || $action == 'request' || $
|
|||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
|
||||||
|
|
||||||
print '</tbody>';
|
print '</tbody>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -1248,6 +1313,9 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
print '</tbody>';
|
print '</tbody>';
|
||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
|
|
||||||
|
|||||||
@ -402,6 +402,8 @@ class Holiday extends CommonObject
|
|||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
$this->fetch_optionals();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -210,68 +210,19 @@ $form = new Form($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
$holidaystatic=new Holiday($db);
|
|
||||||
$fuser = new User($db);
|
$fuser = new User($db);
|
||||||
|
$holidaystatic=new Holiday($db);
|
||||||
|
|
||||||
// Update sold
|
// Update sold
|
||||||
$result = $object->updateBalance();
|
$result = $object->updateBalance();
|
||||||
|
|
||||||
$max_year = 5;
|
|
||||||
$min_year = 10;
|
|
||||||
$filter='';
|
|
||||||
|
|
||||||
$title = $langs->trans('CPTitreMenu');
|
$title = $langs->trans('CPTitreMenu');
|
||||||
llxHeader('', $title);
|
llxHeader('', $title);
|
||||||
|
|
||||||
$order = $db->order($sortfield, $sortorder).$db->plimit($limit + 1, $offset);
|
$max_year = 5;
|
||||||
|
$min_year = 10;
|
||||||
|
|
||||||
// Ref
|
// Get current user id
|
||||||
if(!empty($search_ref))
|
|
||||||
{
|
|
||||||
$filter.= " AND cp.rowid = ".(int) $db->escape($search_ref);
|
|
||||||
}
|
|
||||||
// Start date
|
|
||||||
$filter.= dolSqlDateFilter("cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
|
|
||||||
// End date
|
|
||||||
$filter.= dolSqlDateFilter("cp.date_fin", $search_day_end, $search_month_end, $search_year_end);
|
|
||||||
// Create date
|
|
||||||
$filter.= dolSqlDateFilter("cp.date_create", $search_day_create, $search_month_create, $search_year_create);
|
|
||||||
// Employee
|
|
||||||
if(!empty($search_employee) && $search_employee != -1) {
|
|
||||||
$filter.= " AND cp.fk_user = '".$db->escape($search_employee)."'\n";
|
|
||||||
}
|
|
||||||
// Validator
|
|
||||||
if(!empty($search_valideur) && $search_valideur != -1) {
|
|
||||||
$filter.= " AND cp.fk_validator = '".$db->escape($search_valideur)."'\n";
|
|
||||||
}
|
|
||||||
// Type
|
|
||||||
if (!empty($search_type) && $search_type != -1) {
|
|
||||||
$filter.= ' AND cp.fk_type IN ('.$db->escape($search_type).')';
|
|
||||||
}
|
|
||||||
// Status
|
|
||||||
if(!empty($search_statut) && $search_statut != -1) {
|
|
||||||
$filter.= " AND cp.statut = '".$db->escape($search_statut)."'\n";
|
|
||||||
}
|
|
||||||
// Search all
|
|
||||||
if (!empty($sall))
|
|
||||||
{
|
|
||||||
$filter.= natural_search(array_keys($fieldstosearchall), $sall);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',', $childids).')';
|
|
||||||
|
|
||||||
$sql='';
|
|
||||||
// Add where from extra fields
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
|
||||||
// Add where from hooks
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
$sql.=$hookmanager->resPrint;
|
|
||||||
|
|
||||||
$filter.=$sql;
|
|
||||||
|
|
||||||
|
|
||||||
// Récupération de l'ID de l'utilisateur
|
|
||||||
$user_id = $user->id;
|
$user_id = $user->id;
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
@ -286,75 +237,162 @@ if ($id > 0)
|
|||||||
|
|
||||||
// Récupération des congés payés de l'utilisateur ou de tous les users de sa hierarchy
|
// Récupération des congés payés de l'utilisateur ou de tous les users de sa hierarchy
|
||||||
// Load array $object->holiday
|
// Load array $object->holiday
|
||||||
if (empty($user->rights->holiday->read_all) || $id > 0)
|
|
||||||
{
|
|
||||||
if ($id > 0) $result = $object->fetchByUser($id, $order, $filter);
|
|
||||||
else $result = $object->fetchByUser(join(',', $childids), $order, $filter);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$result = $object->fetchAll($order, $filter);
|
|
||||||
}
|
|
||||||
// Si erreur SQL
|
|
||||||
if ($result == '-1')
|
|
||||||
{
|
|
||||||
print load_fiche_titre($langs->trans('CPTitreMenu'), '', 'title_hrm.png');
|
|
||||||
|
|
||||||
dol_print_error($db, $langs->trans('Error').' '.$object->error);
|
$sql = "SELECT";
|
||||||
exit();
|
$sql.= " cp.rowid,";
|
||||||
|
$sql.= " cp.ref,";
|
||||||
|
|
||||||
|
$sql.= " cp.fk_user,";
|
||||||
|
$sql.= " cp.fk_type,";
|
||||||
|
$sql.= " cp.date_create,";
|
||||||
|
$sql.= " cp.tms as date_update,";
|
||||||
|
$sql.= " cp.description,";
|
||||||
|
$sql.= " cp.date_debut,";
|
||||||
|
$sql.= " cp.date_fin,";
|
||||||
|
$sql.= " cp.halfday,";
|
||||||
|
$sql.= " cp.statut,";
|
||||||
|
$sql.= " cp.fk_validator,";
|
||||||
|
$sql.= " cp.date_valid,";
|
||||||
|
$sql.= " cp.fk_user_valid,";
|
||||||
|
$sql.= " cp.date_refuse,";
|
||||||
|
$sql.= " cp.fk_user_refuse,";
|
||||||
|
$sql.= " cp.date_cancel,";
|
||||||
|
$sql.= " cp.fk_user_cancel,";
|
||||||
|
$sql.= " cp.detail_refuse,";
|
||||||
|
|
||||||
|
$sql.= " uu.lastname as user_lastname,";
|
||||||
|
$sql.= " uu.firstname as user_firstname,";
|
||||||
|
$sql.= " uu.login as user_login,";
|
||||||
|
$sql.= " uu.statut as user_statut,";
|
||||||
|
$sql.= " uu.photo as user_photo,";
|
||||||
|
|
||||||
|
$sql.= " ua.lastname as validator_lastname,";
|
||||||
|
$sql.= " ua.firstname as validator_firstname,";
|
||||||
|
$sql.= " ua.login as validator_login,";
|
||||||
|
$sql.= " ua.statut as validator_statut,";
|
||||||
|
$sql.= " ua.photo as validator_photo";
|
||||||
|
// Add fields from extrafields
|
||||||
|
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||||
|
// Add fields from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp";
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."holiday_extrafields as ef on (cp.rowid = ef.fk_object)";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua";
|
||||||
|
$sql.= " WHERE cp.entity IN (".getEntity('holiday').")";
|
||||||
|
$sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
|
||||||
|
// Search all
|
||||||
|
if (!empty($sall)) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
|
||||||
|
// Ref
|
||||||
|
if(!empty($search_ref))
|
||||||
|
{
|
||||||
|
$sql.= " AND cp.rowid = ".(int) $db->escape($search_ref);
|
||||||
|
}
|
||||||
|
// Start date
|
||||||
|
$sql.= dolSqlDateFilter("cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
|
||||||
|
// End date
|
||||||
|
$sql.= dolSqlDateFilter("cp.date_fin", $search_day_end, $search_month_end, $search_year_end);
|
||||||
|
// Create date
|
||||||
|
$sql.= dolSqlDateFilter("cp.date_create", $search_day_create, $search_month_create, $search_year_create);
|
||||||
|
// Employee
|
||||||
|
if(!empty($search_employee) && $search_employee != -1) {
|
||||||
|
$sql.= " AND cp.fk_user = '".$db->escape($search_employee)."'\n";
|
||||||
|
}
|
||||||
|
// Validator
|
||||||
|
if(!empty($search_valideur) && $search_valideur != -1) {
|
||||||
|
$sql.= " AND cp.fk_validator = '".$db->escape($search_valideur)."'\n";
|
||||||
|
}
|
||||||
|
// Type
|
||||||
|
if (!empty($search_type) && $search_type != -1) {
|
||||||
|
$sql.= ' AND cp.fk_type IN ('.$db->escape($search_type).')';
|
||||||
|
}
|
||||||
|
// Status
|
||||||
|
if(!empty($search_statut) && $search_statut != -1) {
|
||||||
|
$sql.= " AND cp.statut = '".$db->escape($search_statut)."'\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($user->rights->holiday->read_all)) $sql.=' AND cp.fk_user IN ('.join(',', $childids).')';
|
||||||
|
if ($id > 0) $sql.= " AND cp.fk_user IN (".$id.")";
|
||||||
|
|
||||||
// Show table of vacations
|
// Add where from extra fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
|
||||||
$num = count($object->holiday);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
// Count total nb of records
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
|
$result = $db->query($sql);
|
||||||
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$param='';
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
|
||||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
|
||||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
|
||||||
if ($search_day_create) $param.='&search_day_create='.urlencode($search_day_create);
|
|
||||||
if ($search_month_create) $param.='&search_month_create='.urlencode($search_month_create);
|
|
||||||
if ($search_year_create) $param.='&search_year_create='.urlencode($search_year_create);
|
|
||||||
if ($search_day_start) $param.='&search_day_start='.urlencode($search_day_start);
|
|
||||||
if ($search_month_start) $param.='&search_month_start='.urlencode($search_month_start);
|
|
||||||
if ($search_year_start) $param.='&search_year_start='.urlencode($search_year_start);
|
|
||||||
if ($search_day_end) $param.='&search_day_end='.urlencode($search_day_end);
|
|
||||||
if ($search_month_end) $param.='&search_month_end='.urlencode($search_month_end);
|
|
||||||
if ($search_year_end) $param.='&search_year_end='.urlencode($search_year_end);
|
|
||||||
if ($search_employee > 0) $param.='&search_employee='.urlencode($search_employee);
|
|
||||||
if ($search_valideur > 0) $param.='&search_valideur='.urlencode($search_valideur);
|
|
||||||
if ($search_type > 0) $param.='&search_type='.urlencode($search_type);
|
|
||||||
if ($search_statut > 0) $param.='&search_statut='.urlencode($search_statut);
|
|
||||||
// Add $param from extra fields
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
|
||||||
|
|
||||||
// List of mass actions available
|
|
||||||
$arrayofmassactions = array(
|
//print $sql;
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
|
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||||
|
if ($search_day_create) $param.='&search_day_create='.urlencode($search_day_create);
|
||||||
|
if ($search_month_create) $param.='&search_month_create='.urlencode($search_month_create);
|
||||||
|
if ($search_year_create) $param.='&search_year_create='.urlencode($search_year_create);
|
||||||
|
if ($search_day_start) $param.='&search_day_start='.urlencode($search_day_start);
|
||||||
|
if ($search_month_start) $param.='&search_month_start='.urlencode($search_month_start);
|
||||||
|
if ($search_year_start) $param.='&search_year_start='.urlencode($search_year_start);
|
||||||
|
if ($search_day_end) $param.='&search_day_end='.urlencode($search_day_end);
|
||||||
|
if ($search_month_end) $param.='&search_month_end='.urlencode($search_month_end);
|
||||||
|
if ($search_year_end) $param.='&search_year_end='.urlencode($search_year_end);
|
||||||
|
if ($search_employee > 0) $param.='&search_employee='.urlencode($search_employee);
|
||||||
|
if ($search_valideur > 0) $param.='&search_valideur='.urlencode($search_valideur);
|
||||||
|
if ($search_type > 0) $param.='&search_type='.urlencode($search_type);
|
||||||
|
if ($search_statut > 0) $param.='&search_statut='.urlencode($search_statut);
|
||||||
|
// Add $param from extra fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
|
||||||
|
// List of mass actions available
|
||||||
|
$arrayofmassactions = array(
|
||||||
//'generate_doc'=>$langs->trans("ReGeneratePDF"),
|
//'generate_doc'=>$langs->trans("ReGeneratePDF"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
);
|
);
|
||||||
if ($user->rights->holiday->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
if ($user->rights->holiday->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
// Lines of title fields
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
print '<form id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="action" value="'.($action=='edit'?'update':'list').'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
if ($id > 0) print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
if ($id > 0) print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
|
||||||
if ($id > 0) // For user tab
|
if ($id > 0) // For user tab
|
||||||
{
|
{
|
||||||
$title = $langs->trans("User");
|
$title = $langs->trans("User");
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
$head = user_prepare_head($fuser);
|
$head = user_prepare_head($fuser);
|
||||||
@ -386,13 +424,9 @@ if ($id > 0) // For user tab
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$nbtotalofrecords = count($object->holiday);
|
|
||||||
//print $num;
|
|
||||||
//print count($object->holiday);
|
|
||||||
|
|
||||||
$title = $langs->trans("ListeCP");
|
$title = $langs->trans("ListeCP");
|
||||||
|
|
||||||
$newcardbutton='';
|
$newcardbutton='';
|
||||||
@ -402,58 +436,58 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm.png', 0, $newcardbutton, '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm.png', 0, $newcardbutton, '', $limit);
|
||||||
|
}
|
||||||
|
|
||||||
$topicmail="Information";
|
$topicmail="Information";
|
||||||
$modelmail="leaverequest";
|
$modelmail="leaverequest";
|
||||||
$objecttmp=new Holiday($db);
|
$objecttmp=new Holiday($db);
|
||||||
$trackid='leav'.$object->id;
|
$trackid='leav'.$object->id;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
}
|
|
||||||
|
|
||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
|
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$moreforfilter='';
|
$moreforfilter='';
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||||
else $moreforfilter = $hookmanager->resPrint;
|
else $moreforfilter = $hookmanager->resPrint;
|
||||||
|
|
||||||
if (! empty($moreforfilter))
|
if (! empty($moreforfilter))
|
||||||
{
|
{
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
print $moreforfilter;
|
print $moreforfilter;
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||||
|
|
||||||
|
|
||||||
$include = '';
|
$include = '';
|
||||||
if (! empty($user->rights->holiday->read_all)) $include = 'hierarchyme'; // Can see all
|
if (! empty($user->rights->holiday->read_all)) $include = 'hierarchyme'; // Can see all
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
|
|
||||||
|
|
||||||
// Filters
|
// Filters
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
|
|
||||||
if (! empty($arrayfields['cp.ref']['checked']))
|
if (! empty($arrayfields['cp.ref']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" size="4" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
print '<input class="flat" size="4" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($arrayfields['cp.fk_user']['checked']))
|
if (! empty($arrayfields['cp.fk_user']['checked']))
|
||||||
{
|
{
|
||||||
$morefilter = 'AND employee = 1';
|
$morefilter = 'AND employee = 1';
|
||||||
if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
|
if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
|
||||||
|
|
||||||
@ -469,11 +503,11 @@ if (! empty($arrayfields['cp.fk_user']['checked']))
|
|||||||
print '<td class="liste_titre maxwidthonsmartphone left">';
|
print '<td class="liste_titre maxwidthonsmartphone left">';
|
||||||
print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
|
print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Approver
|
// Approver
|
||||||
if (! empty($arrayfields['cp.fk_validator']['checked']))
|
if (! empty($arrayfields['cp.fk_validator']['checked']))
|
||||||
{
|
{
|
||||||
if ($user->rights->holiday->read_all)
|
if ($user->rights->holiday->read_all)
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre maxwidthonsmartphone left">';
|
print '<td class="liste_titre maxwidthonsmartphone left">';
|
||||||
@ -489,11 +523,11 @@ if (! empty($arrayfields['cp.fk_validator']['checked']))
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
if (! empty($arrayfields['cp.fk_type']['checked']))
|
if (! empty($arrayfields['cp.fk_type']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
if (empty($mysoc->country_id)) {
|
if (empty($mysoc->country_id)) {
|
||||||
setEventMessages(null, array($langs->trans("ErrorSetACountryFirst"),$langs->trans("CompanyFoundation")), 'errors');
|
setEventMessages(null, array($langs->trans("ErrorSetACountryFirst"),$langs->trans("CompanyFoundation")), 'errors');
|
||||||
@ -509,104 +543,104 @@ if (! empty($arrayfields['cp.fk_type']['checked']))
|
|||||||
print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1);
|
print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
if (! empty($arrayfields['duration']['checked']))
|
if (! empty($arrayfields['duration']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start date
|
// Start date
|
||||||
if (! empty($arrayfields['cp.date_debut']['checked']))
|
if (! empty($arrayfields['cp.date_debut']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center nowraponall">';
|
||||||
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month_start" value="'.dol_escape_htmltag($search_month_start).'">';
|
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_start" value="'.dol_escape_htmltag($search_month_start).'">';
|
||||||
$formother->select_year($search_year_start, 'search_year_start', 1, $min_year, $max_year);
|
$formother->select_year($search_year_start, 'search_year_start', 1, $min_year, $max_year);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// End date
|
// End date
|
||||||
if (! empty($arrayfields['cp.date_fin']['checked']))
|
if (! empty($arrayfields['cp.date_fin']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center nowraponall">';
|
||||||
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).'">';
|
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).'">';
|
||||||
$formother->select_year($search_year_end, 'search_year_end', 1, $min_year, $max_year);
|
$formother->select_year($search_year_end, 'search_year_end', 1, $min_year, $max_year);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
// Create date
|
// Create date
|
||||||
if (! empty($arrayfields['cp.date_create']['checked']))
|
if (! empty($arrayfields['cp.date_create']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center nowraponall">';
|
||||||
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month_create" value="'.dol_escape_htmltag($search_month_create).'">';
|
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);
|
$formother->select_year($search_year_create, 'search_year_create', 1, $min_year, 0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create date
|
// Create date
|
||||||
if (! empty($arrayfields['cp.tms']['checked']))
|
if (! empty($arrayfields['cp.tms']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center nowraponall">';
|
||||||
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month_update" value="'.dol_escape_htmltag($search_month_update).'">';
|
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);
|
$formother->select_year($search_year_update, 'search_year_update', 1, $min_year, 0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
if (! empty($arrayfields['cp.statut']['checked']))
|
if (! empty($arrayfields['cp.statut']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre maxwidthonsmartphone maxwidth200 right">';
|
print '<td class="liste_titre maxwidthonsmartphone maxwidth200 right">';
|
||||||
$object->selectStatutCP($search_statut, 'search_statut');
|
$object->selectStatutCP($search_statut, 'search_statut');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Action column
|
||||||
print '<td class="liste_titre maxwidthsearch">';
|
print '<td class="liste_titre maxwidthsearch">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if (! empty($arrayfields['cp.ref']['checked'])) print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], "cp.ref", "", $param, '', $sortfield, $sortorder);
|
if (! empty($arrayfields['cp.ref']['checked'])) print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], "cp.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['cp.fk_user']['checked'])) print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], "cp.fk_user", "", $param, '', $sortfield, $sortorder);
|
if (! empty($arrayfields['cp.fk_user']['checked'])) print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], "cp.fk_user", "", $param, '', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['cp.fk_validator']['checked'])) print_liste_field_titre($arrayfields['cp.fk_validator']['label'], $_SERVER["PHP_SELF"], "cp.fk_validator", "", $param, '', $sortfield, $sortorder);
|
if (! empty($arrayfields['cp.fk_validator']['checked'])) print_liste_field_titre($arrayfields['cp.fk_validator']['label'], $_SERVER["PHP_SELF"], "cp.fk_validator", "", $param, '', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['cp.fk_type']['checked'])) print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
if (! empty($arrayfields['cp.fk_type']['checked'])) print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['duration']['checked'])) print_liste_field_titre($arrayfields['duration']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
if (! empty($arrayfields['duration']['checked'])) print_liste_field_titre($arrayfields['duration']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
if (! empty($arrayfields['cp.date_debut']['checked'])) print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center ');
|
if (! empty($arrayfields['cp.date_debut']['checked'])) print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
if (! empty($arrayfields['cp.date_fin']['checked'])) print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center ');
|
if (! empty($arrayfields['cp.date_fin']['checked'])) print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
// Hook fields
|
// Hook fields
|
||||||
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (! empty($arrayfields['cp.date_create']['checked'])) print_liste_field_titre($arrayfields['cp.date_create']['label'], $_SERVER["PHP_SELF"], "cp.date_create", "", $param, '', $sortfield, $sortorder, 'center ');
|
if (! empty($arrayfields['cp.date_create']['checked'])) print_liste_field_titre($arrayfields['cp.date_create']['label'], $_SERVER["PHP_SELF"], "cp.date_create", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
if (! empty($arrayfields['cp.tms']['checked'])) print_liste_field_titre($arrayfields['cp.tms']['label'], $_SERVER["PHP_SELF"], "cp.tms", "", $param, '', $sortfield, $sortorder, 'center ');
|
if (! empty($arrayfields['cp.tms']['checked'])) print_liste_field_titre($arrayfields['cp.tms']['label'], $_SERVER["PHP_SELF"], "cp.tms", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
if (! empty($arrayfields['cp.statut']['checked'])) print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
if (! empty($arrayfields['cp.statut']['checked'])) print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon"));
|
$listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon"));
|
||||||
|
|
||||||
|
|
||||||
// If we ask a dedicated card and not allow to see it, we forc on user.
|
// If we ask a dedicated card and not allow to see it, we force on user.
|
||||||
if ($id && empty($user->rights->holiday->read_all) && ! in_array($id, $childids)) {
|
if ($id && empty($user->rights->holiday->read_all) && ! in_array($id, $childids)) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print '<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans("NotEnoughPermissions").'</td></tr>';
|
print '<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans("NotEnoughPermissions").'</td></tr>';
|
||||||
$result = 0;
|
$result = 0;
|
||||||
}
|
}
|
||||||
elseif (! empty($object->holiday) && !empty($mysoc->country_id))
|
elseif ($num > 0 && !empty($mysoc->country_id))
|
||||||
{
|
{
|
||||||
// Lines
|
// Lines
|
||||||
$userstatic = new User($db);
|
$userstatic = new User($db);
|
||||||
$approbatorstatic = new User($db);
|
$approbatorstatic = new User($db);
|
||||||
@ -615,39 +649,41 @@ elseif (! empty($object->holiday) && !empty($mysoc->country_id))
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$totalarray=array();
|
$totalarray=array();
|
||||||
foreach($object->holiday as $infos_CP)
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
// Leave request
|
// Leave request
|
||||||
$holidaystatic->id=$infos_CP['rowid'];
|
$holidaystatic->id=$obj->rowid;
|
||||||
$holidaystatic->ref=($infos_CP['ref']?$infos_CP['ref']:$infos_CP['rowid']);
|
$holidaystatic->ref=($obj->ref?$obj->ref:$obj->rowid);
|
||||||
|
|
||||||
// User
|
// User
|
||||||
$userstatic->id=$infos_CP['fk_user'];
|
$userstatic->id=$obj->fk_user;
|
||||||
$userstatic->lastname=$infos_CP['user_lastname'];
|
$userstatic->lastname=$obj->user_lastname;
|
||||||
$userstatic->firstname=$infos_CP['user_firstname'];
|
$userstatic->firstname=$obj->user_firstname;
|
||||||
$userstatic->login=$infos_CP['user_login'];
|
$userstatic->login=$obj->user_login;
|
||||||
$userstatic->statut=$infos_CP['user_statut'];
|
$userstatic->statut=$obj->user_statut;
|
||||||
$userstatic->photo=$infos_CP['user_photo'];
|
$userstatic->photo=$obj->user_photo;
|
||||||
|
|
||||||
// Validator
|
// Validator
|
||||||
$approbatorstatic->id=$infos_CP['fk_validator'];
|
$approbatorstatic->id=$obj->fk_validator;
|
||||||
$approbatorstatic->lastname=$infos_CP['validator_lastname'];
|
$approbatorstatic->lastname=$obj->validator_lastname;
|
||||||
$approbatorstatic->firstname=$infos_CP['validator_firstname'];
|
$approbatorstatic->firstname=$obj->validator_firstname;
|
||||||
$approbatorstatic->login=$infos_CP['validator_login'];
|
$approbatorstatic->login=$obj->validator_login;
|
||||||
$approbatorstatic->statut=$infos_CP['validator_statut'];
|
$approbatorstatic->statut=$obj->validator_statut;
|
||||||
$approbatorstatic->photo=$infos_CP['validator_photo'];
|
$approbatorstatic->photo=$obj->validator_photo;
|
||||||
|
|
||||||
$date = $infos_CP['date_create'];
|
$date = $obj->date_create;
|
||||||
$date_modif = $infos_CP['date_update'];
|
$date_modif = $obj->date_update;
|
||||||
|
|
||||||
$starthalfday=($infos_CP['halfday'] == -1 || $infos_CP['halfday'] == 2)?'afternoon':'morning';
|
$starthalfday=($obj->halfday == -1 || $obj->halfday == 2)?'afternoon':'morning';
|
||||||
$endhalfday=($infos_CP['halfday'] == 1 || $infos_CP['halfday'] == 2)?'morning':'afternoon';
|
$endhalfday=($obj->halfday == 1 || $obj->halfday == 2)?'morning':'afternoon';
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
if (! empty($arrayfields['cp.ref']['checked']))
|
if (! empty($arrayfields['cp.ref']['checked']))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td class="nowraponall">';
|
||||||
print $holidaystatic->getNomUrl(1, 1);
|
print $holidaystatic->getNomUrl(1, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
@ -665,15 +701,15 @@ elseif (! empty($object->holiday) && !empty($mysoc->country_id))
|
|||||||
if (! empty($arrayfields['cp.fk_type']['checked']))
|
if (! empty($arrayfields['cp.fk_type']['checked']))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$labeltypeleavetoshow = ($langs->trans($typeleaves[$infos_CP['fk_type']]['code'])!=$typeleaves[$infos_CP['fk_type']]['code'] ? $langs->trans($typeleaves[$infos_CP['fk_type']]['code']) : $typeleaves[$infos_CP['fk_type']]['label']);
|
$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[$infos_CP['fk_type']]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $infos_CP['fk_type']) : $labeltypeleavetoshow;
|
print empty($typeleaves[$obj->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['duration']['checked']))
|
if (! empty($arrayfields['duration']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
$nbopenedday=num_open_day($infos_CP['date_debut_gmt'], $infos_CP['date_fin_gmt'], 0, 1, $infos_CP['halfday']);
|
$nbopenedday=num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday);
|
||||||
print $nbopenedday.' '.$langs->trans('DurationDays');
|
print $nbopenedday.' '.$langs->trans('DurationDays');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
@ -681,7 +717,7 @@ elseif (! empty($object->holiday) && !empty($mysoc->country_id))
|
|||||||
if (! empty($arrayfields['cp.date_debut']['checked']))
|
if (! empty($arrayfields['cp.date_debut']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print dol_print_date($infos_CP['date_debut'], 'day');
|
print dol_print_date($db->jdate($obj->date_debut), 'day');
|
||||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>';
|
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
@ -689,7 +725,7 @@ elseif (! empty($object->holiday) && !empty($mysoc->country_id))
|
|||||||
if (! empty($arrayfields['cp.date_fin']['checked']))
|
if (! empty($arrayfields['cp.date_fin']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print dol_print_date($infos_CP['date_fin'], 'day');
|
print dol_print_date($db->jdate($obj->date_fin), 'day');
|
||||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>';
|
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
@ -705,17 +741,17 @@ elseif (! empty($object->holiday) && !empty($mysoc->country_id))
|
|||||||
// Date creation
|
// Date creation
|
||||||
if (! empty($arrayfields['cp.date_create']['checked']))
|
if (! empty($arrayfields['cp.date_create']['checked']))
|
||||||
{
|
{
|
||||||
print '<td style="text-align: center;">'.dol_print_date($date, 'day').'</td>';
|
print '<td style="text-align: center;">'.dol_print_date($date, 'dayhour').'</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['cp.tms']['checked']))
|
if (! empty($arrayfields['cp.tms']['checked']))
|
||||||
{
|
{
|
||||||
print '<td style="text-align: center;">'.dol_print_date($date_modif, 'day').'</td>';
|
print '<td style="text-align: center;">'.dol_print_date($date_modif, 'dayhour').'</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['cp.statut']['checked']))
|
if (! empty($arrayfields['cp.statut']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right nowrap">'.$holidaystatic->LibStatut($infos_CP['statut'], 5).'</td>';
|
print '<td class="right nowrap">'.$holidaystatic->LibStatut($obj->statut, 5).'</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,8 +760,8 @@ elseif (! empty($object->holiday) && !empty($mysoc->country_id))
|
|||||||
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;
|
$selected=0;
|
||||||
if (in_array($infos_CP['rowid'], $arrayofselected)) $selected=1;
|
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||||
print '<input id="cb'.$infos_CP['rowid'].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$infos_CP['rowid'].'"'.($selected?' checked="checked"':'').'>';
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
@ -734,28 +770,25 @@ elseif (! empty($object->holiday) && !empty($mysoc->country_id))
|
|||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si il n'y a pas d'enregistrement suite à une recherche
|
// Si il n'y a pas d'enregistrement suite à une recherche
|
||||||
if ($result == '2')
|
if ($num == 0)
|
||||||
{
|
{
|
||||||
print '<tr>';
|
$colspan=1;
|
||||||
print '<td colspan="10" class="opacitymedium">'.$langs->trans('NoRecordFound').'</td>';
|
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||||
print '</tr>';
|
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
/*if ($user_id == $user->id)
|
|
||||||
{
|
|
||||||
print '<br>';
|
|
||||||
print '<div style="float: right; margin-top: 8px;">';
|
|
||||||
print '<a href="./card.php?action=request" class="butAction">'.$langs->trans('AddCP').'</a>';
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}*/
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user