Fix filter on holiday statut
Fix tr/td balance for extrafields on lines
This commit is contained in:
parent
a325bbf865
commit
8cf2d4eb45
@ -1680,11 +1680,9 @@ else
|
||||
|
||||
// Display lines extrafields
|
||||
if (is_array($extralabelslines) && count($extralabelslines)>0) {
|
||||
print '<tr '.$bcnd[$var].'>';
|
||||
$line = new ContratLigne($db);
|
||||
$line->fetch_optionals($objp->rowid,$extralabelslines);
|
||||
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
|
||||
@ -1752,13 +1750,12 @@ else
|
||||
print ' '.$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,$extralabelslines);
|
||||
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>';
|
||||
|
||||
@ -5371,7 +5371,7 @@ abstract class CommonObject
|
||||
$label = $val['label'];
|
||||
$type = $val['type'];
|
||||
$size = $val['css'];
|
||||
|
||||
|
||||
// Convert var to be able to share same code than showOutputField of extrafields
|
||||
if (preg_match('/varchar\((\d+)\)/', $type, $reg))
|
||||
{
|
||||
@ -5708,15 +5708,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;
|
||||
|
||||
@ -5780,15 +5780,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')))
|
||||
{
|
||||
@ -5806,10 +5804,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":
|
||||
@ -5821,9 +5826,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++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,7 +350,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)
|
||||
|
||||
@ -1364,11 +1364,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/view_log.php?action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday);
|
||||
}
|
||||
|
||||
@ -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 -->
|
||||
@ -363,41 +394,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
|
||||
{
|
||||
|
||||
@ -225,16 +225,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]; ?>>
|
||||
<td colspan="<?php echo 7+$colspan ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
|
||||
|
||||
@ -285,13 +285,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 -->
|
||||
|
||||
@ -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') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user