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

Conflicts:
	htdocs/contrat/card.php
	htdocs/core/class/conf.class.php
	htdocs/core/tpl/objectline_view.tpl.php
	htdocs/holiday/list.php
This commit is contained in:
Laurent Destailleur 2018-03-20 14:52:27 +01:00
commit d7ad899839
14 changed files with 136 additions and 125 deletions

View File

@ -1705,14 +1705,11 @@ else
print '</tr>';
}
// Display lines extrafields
if (is_array($extralabelslines) && count($extralabelslines)>0) {
print '<tr '.$bcnd[$var].'>';
$line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid);
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bcnd[$var], 'colspan'=>$colspan));
print '</tr>';
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bcnd[$var], 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
}
// Ligne en mode update
@ -1767,7 +1764,8 @@ else
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Modify").'">';
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
print '</tr>';
$colspan=6;
if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) $colspan++;
if($conf->global->PRODUCT_USE_UNITS) $colspan++;
@ -1780,16 +1778,13 @@ else
print ' &nbsp;&nbsp;'.$langs->trans("DateEndPlanned").' ';
$form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update");
print '</td>';
print '</tr>';
if (is_array($extralabelslines) && count($extralabelslines)>0) {
print '<tr '.$bcnd[$var].'>';
$line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid);
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$colspan));
print '</tr>';
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
print '</tr>';
}
$db->free($result);

View File

@ -5908,15 +5908,15 @@ abstract class CommonObject
/**
* Function to show lines of extrafields with output datas
*
* @param Extrafields $extrafields Extrafield Object
* @param string $mode Show output (view) or input (edit) for extrafield
* @param array $params Optional parameters
* @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names)
*
* @return string
* @param Extrafields $extrafields Extrafield Object
* @param string $mode Show output (view) or input (edit) for extrafield
* @param array $params Optional parameters
* @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names)
* @param string $onetrtd All fields in same tr td
* @return string
*/
function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='')
function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='', $onetrtd=0)
{
global $_POST, $conf, $langs, $action;
@ -5980,15 +5980,13 @@ abstract class CommonObject
$csstyle=$params['style'];
}
}
if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
if (empty($onetrtd))
{
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
$colspan='0';
}
else
{
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
}
// Convert date into timestamp format (value in memory must be a timestamp)
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
@ -6006,10 +6004,17 @@ abstract class CommonObject
{
$labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>';
}
$out .= '<td>'.$labeltoshow.'</td>';
if (empty($onetrtd)) $out .= '<td>';
else $out .= '<td'.($colspan?' colspan="'.($colspan+1).'"':'').'>';
$out .= $labeltoshow;
if (empty($onetrtd)) $out .= '</td><td'.($colspan?' colspan="'.($colspan).'"':'').'>';
else $out.=' ';
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
$out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan?' colspan="'.$colspan.'"':'').'>';
$out .='<span id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'">';
switch($mode) {
case "view":
@ -6021,9 +6026,8 @@ abstract class CommonObject
}
$out .= '</td>';
$out .= '</tr>';
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '</tr>';
else $out .= '</tr>';
$e++;
}
}

View File

@ -425,7 +425,7 @@ class Conf
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
$this->currency=$this->global->MAIN_MONNAIE;
if (empty($conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure
if (empty($this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) $this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure
// conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
@ -584,15 +584,15 @@ class Conf
if (! isset($this->global->THEME_HIDE_BORDER_ON_INPUT)) $this->global->THEME_HIDE_BORDER_ON_INPUT=0;
// Save inconsistent option
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && (! isset($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $conf->global->AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO'))
if (empty($this->global->AGENDA_USE_EVENT_TYPE) && (! isset($this->global->AGENDA_DEFAULT_FILTER_TYPE) || $this->global->AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO'))
{
$conf->global->AGENDA_DEFAULT_FILTER_TYPE='0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
$this->global->AGENDA_DEFAULT_FILTER_TYPE='0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
}
if (! isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1;
$conf->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com';
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567';
$this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com';
$this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567';
// For backward compatibility
if (isset($this->product)) $this->produit=$this->product;

View File

@ -1447,7 +1447,7 @@ class Form
/**
* Return select list of users
*
* @param string $selected User id or user object of user preselected. If -1, we use id of current user.
* @param string $selected User id or user object of user preselected. If 0 or < -2, we use id of current user. If -1, keep unselected (if empty is allowed)
* @param string $htmlname Field name in form
* @param int $show_empty 0=list with no empty value, 1=add also an empty value into list
* @param array $exclude Array list of users id to exclude

View File

@ -352,7 +352,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/list.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->read', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/card.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/list.php?&leftmenu=hrm', 'List', 1, 'holiday', '$user->rights->holiday->read', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5002__+MAX_llx_menu__, '/holiday/list.php?select_statut=2&leftmenu=hrm', 'ListToApprove', 2, 'trips', '$user->rights->holiday->read', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5002__+MAX_llx_menu__, '/holiday/list.php?search_statut=2&leftmenu=hrm', 'ListToApprove', 2, 'trips', '$user->rights->holiday->read', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5005__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 3, __ENTITY__);
-- HRM - Trips and expenses (old module)

View File

@ -1371,11 +1371,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm');
$newmenu->add("/holiday/card.php?action=request", $langs->trans("New"), 1,$user->rights->holiday->write);
$newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("List"), 1,$user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?select_statut=1&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?select_statut=2&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?select_statut=3&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?select_statut=4&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?select_statut=5&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=1&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=2&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=3&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=4&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=5&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/define_holiday.php?action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read);
$newmenu->add("/holiday/month_report.php", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all);
$newmenu->add("/holiday/view_log.php?action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday);

View File

@ -58,6 +58,37 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
$colspan = 3; // Col total ht + col edit + col delete
if (in_array($object->element,array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
//print $object->element;
// Lines for extrafield
$objectline = null;
if (!empty($extrafieldsline))
{
if ($this->table_element_line=='commandedet') {
$objectline = new OrderLine($this->db);
}
elseif ($this->table_element_line=='propaldet') {
$objectline = new PropaleLigne($this->db);
}
elseif ($this->table_element_line=='supplier_proposaldet') {
$objectline = new SupplierProposalLine($this->db);
}
elseif ($this->table_element_line=='facturedet') {
$objectline = new FactureLigne($this->db);
}
elseif ($this->table_element_line=='contratdet') {
$objectline = new ContratLigne($this->db);
}
elseif ($this->table_element_line=='commande_fournisseurdet') {
$objectline = new CommandeFournisseurLigne($this->db);
}
elseif ($this->table_element_line=='facture_fourn_det') {
$objectline = new SupplierInvoiceLine($this->db);
}
elseif ($this->table_element_line=='facturedet_rec') {
$objectline = new FactureLigneRec($this->db);
}
}
?>
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
@ -384,41 +415,14 @@ else {
<td class="nobottom linecoledit" align="center" valign="middle" colspan="<?php echo $colspan; ?>">
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
</td>
<?php
// Lines for extrafield
if (!empty($extrafieldsline))
{
if ($this->table_element_line=='commandedet') {
$newline = new OrderLine($this->db);
}
elseif ($this->table_element_line=='propaldet') {
$newline = new PropaleLigne($this->db);
}
elseif ($this->table_element_line=='supplier_proposaldet') {
$newline = new SupplierProposalLine($this->db);
}
elseif ($this->table_element_line=='facturedet') {
$newline = new FactureLigne($this->db);
}
elseif ($this->table_element_line=='contratdet') {
$newline = new ContratLigne($this->db);
}
elseif ($this->table_element_line=='commande_fournisseurdet') {
$newline = new CommandeFournisseurLigne($this->db);
}
elseif ($this->table_element_line=='facture_fourn_det') {
$newline = new SupplierInvoiceLine($this->db);
}
elseif ($this->table_element_line=='facturedet_rec') {
$newline = new FactureLigneRec($this->db);
}
if (is_object($newline)) {
print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8));
}
}
?>
</tr>
<?php
if (is_object($objectline)) {
print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
?>
<?php
if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required
{

View File

@ -240,16 +240,16 @@ $coldisplay=-1; // We remove first td
<input type="submit" class="button" id="savelinebutton" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
<input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
</td>
<?php
//Line extrafield
if (!empty($extrafieldsline))
{
print $line->showOptionals($extrafieldsline,'edit',array('style'=>$bc[$var],'colspan'=>$coldisplay));
}
?>
</tr>
<?php
//Line extrafield
if (!empty($extrafieldsline))
{
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
?>
<?php if (! empty($conf->service->enabled) && $line->product_type == 1 && $dateSelector) { ?>
<tr id="service_duration_area" <?php echo $bc[$var]; ?>>
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>

View File

@ -304,14 +304,14 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>
<?php } ?>
</tr>
<?php
//Line extrafield
if (!empty($extrafieldsline))
{
print $line->showOptionals($extrafieldsline,'view',array('style'=>$bcdd[$var],'colspan'=>$coldisplay));
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bcdd[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
?>
</tr>
<!-- END PHP TEMPLATE objectline_view.tpl.php -->

View File

@ -50,6 +50,18 @@ $now=dol_now();
$langs->load("holiday");
$childids = $user->getAllChildIds(1);
$cancreate = 0;
if (! empty($user->rights->holiday->write_all)) $cancreate=1;
if (! empty($user->rights->holiday->write) && in_array($fuserid, $childids)) $cancreate=1;
$candelete = 0;
if (! empty($user->rights->holiday->delete)) $candelete=1;
$morefilter = 'AND employee = 1';
if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
/*
* Actions
@ -61,8 +73,7 @@ if ($action == 'create')
$object = new Holiday($db);
// If no right to create a request
$fuserid = GETPOST('fuserid','int');
if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
if (! $cancreate)
{
$error++;
setEventMessages($langs->trans('CantCreateCP'), null, 'errors');
@ -201,13 +212,11 @@ if ($action == 'update')
$object = new Holiday($db);
$object->fetch($id);
$canedit=(($user->id == $object->fk_user && $user->rights->holiday->write) || ($user->id != $object->fk_user && $user->rights->holiday->write_all));
// If under validation
if ($object->statut == 1)
{
// If this is the requestor or has read/write rights
if ($canedit)
if ($cancreate)
{
$valideur = $_POST['valideur'];
$description = trim($_POST['description']);
@ -280,13 +289,11 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights-
$object = new Holiday($db);
$object->fetch($id);
$canedit=(($user->id == $object->fk_user && $user->rights->holiday->write) || ($user->id != $object->fk_user && $user->rights->holiday->write_all));
// If this is a rough draft, approved, canceled or refused
if ($object->statut == 1 || $object->statut == 4 || $object->statut == 5)
{
// Si l'utilisateur à le droit de lire cette demande, il peut la supprimer
if ($canedit)
if ($candelete)
{
$result=$object->delete($user);
}
@ -314,10 +321,8 @@ if ($action == 'confirm_send')
$object = new Holiday($db);
$object->fetch($id);
$canedit=(($user->id == $object->fk_user && $user->rights->holiday->write) || ($user->id != $object->fk_user && $user->rights->holiday->write_all));
// Si brouillon et créateur
if($object->statut == 1 && $canedit)
if($object->statut == 1 && $cancreate)
{
$object->statut = 2;
@ -615,7 +620,7 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
$object->fetch($id);
// Si statut en attente de validation et valideur = valideur ou utilisateur, ou droits de faire pour les autres
if (($object->statut == 2 || $object->statut == 3) && ($user->id == $object->fk_validator || $user->id == $object->fk_user || ! empty($user->rights->holiday->write_all)))
if (($object->statut == 2 || $object->statut == 3) && ($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all)))
{
$db->begin();
@ -849,10 +854,10 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
print '<td>';
if (empty($user->rights->holiday->write_all))
{
print $form->select_dolusers($fuserid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
print $form->select_dolusers(($fuserid?$fuserid:$user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300');
//print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
}
else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, 'AND employee = 1');
else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300');
print '</td>';
print '</tr>';
@ -957,8 +962,6 @@ else
{
$object->fetch($id);
$canedit=(($user->id == $object->fk_user && $user->rights->holiday->write) || ($user->id != $object->fk_user && $user->rights->holiday->write_all));
$valideur = new User($db);
$valideur->fetch($object->fk_validator);
@ -1005,7 +1008,7 @@ else
}
// On vérifie si l'utilisateur à le droit de lire cette demande
if ($canedit)
if ($cancreate)
{
if ($action == 'delete')
{
@ -1244,7 +1247,7 @@ else
if ($action == 'edit' && $object->statut == 1)
{
print '<div align="center">';
if ($canedit && $object->statut == 1)
if ($cancreate && $object->statut == 1)
{
print '<input type="submit" value="'.$langs->trans("Save").'" class="button">';
}
@ -1259,11 +1262,11 @@ else
print '<div class="tabsAction">';
// Boutons d'actions
if ($canedit && $object->statut == 1)
if ($cancreate && $object->statut == 1)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit" class="butAction">'.$langs->trans("EditCP").'</a>';
}
if ($canedit && $object->statut == 1)
if ($cancreate && $object->statut == 1) // If draft
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>';
}
@ -1272,7 +1275,7 @@ else
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>';
}
if ($object->statut == 2)
if ($object->statut == 2) // If validated
{
if ($user->id == $object->fk_validator)
{
@ -1286,13 +1289,13 @@ else
}
}
if (($user->id == $object->fk_validator || $user->id == $object->fk_user || ! empty($user->rights->holiday->write_all)) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved
if (($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all)) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved
{
if (($object->date_debut > dol_now()) || $user->admin) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>';
else print '<a href="#" class="butActionRefused" title="'.$langs->trans("HolidayStarted").'">'.$langs->trans("ActionCancelCP").'</a>';
}
if ($canedit && $object->statut == 4)
if ($cancreate && $object->statut == 4)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=backtodraft" class="butAction">'.$langs->trans("SetToDraft").'</a>';
}

View File

@ -958,7 +958,7 @@ class Holiday extends CommonObject
* Affiche un select HTML des statuts de congés payés
*
* @param int $selected Id of preselected status
* @param string $select_statut Name of HTML select field
* @param string $htmlname Name of HTML select field
* @return string Show select of status
*/
function selectStatutCP($selected='', $htmlname='select_statut') {

View File

@ -107,6 +107,7 @@ $fieldstosearchall = array(
'uu.firstname'=>'EmployeeFirstname'
);
$childids = $user->getAllChildIds(1);
/*
@ -171,9 +172,6 @@ $holiday = new Holiday($db);
$holidaystatic=new Holiday($db);
$fuser = new User($db);
$childids = $user->getAllChildIds();
$childids[]=$user->id;
// Update sold
$result = $holiday->updateBalance();
@ -313,7 +311,7 @@ if ($search_year_create) $param.='&search_year_create='.urlencode($searc
if ($search_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 ($day_end) $param.='&day_end='.urlencode($day_end);
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);
@ -412,6 +410,10 @@ print '<input class="flat" type="text" size="1" maxlength="2" name="search_month
$formother->select_year($search_year_create,'search_year_create',1, $min_year, 0);
print '</td>';
$morefilter = 'AND employee = 1';
if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
// User
$disabled=0;
// If into the tab holiday of a user ($id is set in such a case)
@ -422,15 +424,16 @@ if ($id && ! GETPOSTISSET('search_employee'))
}
if (! empty($user->rights->holiday->read_all)) // Can see all
{
print '<td class="liste_titre maxwidthonsmartphone" align="left">';
print $form->select_dolusers($search_employee,"search_employee",1,"",$disabled,'','',0,0,0,'',0,'','maxwidth200');
if (GETPOSTISSET('search_employee')) $search_employee=GETPOST('search_employee','int');
print '<td class="liste_titre maxwidthonsmartphone" align="left">';
print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
print '</td>';
}
else
{
//print '<td class="liste_titre">&nbsp;</td>';
if (GETPOSTISSET('search_employee')) $search_employee=GETPOST('search_employee','int');
print '<td class="liste_titre maxwidthonsmartphone" align="left">';
print $form->select_dolusers($search_employee,"search_employee",1,"",$disabled,'hierarchyme','',0,0,0,'',0,'','maxwidth200');
print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
print '</td>';
}
@ -444,7 +447,7 @@ if ($user->rights->holiday->read_all)
$valideurobjects = $validator->listUsersForGroup($excludefilter);
$valideurarray = array();
foreach($valideurobjects as $val) $valideurarray[$val->id]=$val->id;
print $form->select_dolusers($search_valideur,"search_valideur",1,"",0,$valideurarray,'', 0, 0, 0, '', 0, '', 'maxwidth200');
print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
print '</td>';
}
else
@ -510,9 +513,10 @@ $listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->tran
// If we ask a dedicated card and not allow to see it, we forc on user.
if ($id && empty($user->rights->holiday->read_all) && ! in_array($id, $childis))
if ($id && empty($user->rights->holiday->read_all) && ! in_array($id, $childids))
{
print '<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans("NotEnoughPermission").'</td></tr>';
$langs->load("errors");
print '<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans("NotEnoughPermissions").'</td></tr>';
$result = 0;
}
// Lines

View File

@ -837,11 +837,11 @@ Permission1251=Run mass imports of external data into database (data load)
Permission1321=Export customer invoices, attributes and payments
Permission1322=Reopen a paid bill
Permission1421=Export customer orders and attributes
Permission20001=Read leave requests (yours and your subordinates)
Permission20002=Create/modify your leave requests
Permission20001=Read leave requests (your leaves and the one of your subordinates)
Permission20002=Create/modify your leave requests (yours leaves and the one of your subordinates)
Permission20003=Delete leave requests
Permission20004=Read all leave requests (even user not subordinates)
Permission20005=Create/modify leave requests for everybody
Permission20004=Read all leave requests (even of user not subordinates)
Permission20005=Create/modify leave requests for everybody (even of user not subordinates)
Permission20006=Admin leave requests (setup and update balance)
Permission23001=Read Scheduled job
Permission23002=Create/update Scheduled job

View File

@ -71,6 +71,7 @@ DateRefusCP=Date of refusal
DateCancelCP=Date of cancellation
DefineEventUserCP=Assign an exceptional leave for a user
addEventToUserCP=Assign leave
NotTheAssignedApprover=You are not the assigned approver
MotifCP=Reason
UserCP=User
ErrorAddEventToUserCP=An error occurred while adding the exceptional leave.