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

This commit is contained in:
Laurent Destailleur 2017-07-07 22:05:01 +02:00
commit 5ad6d70397
8 changed files with 129 additions and 119 deletions

View File

@ -134,6 +134,7 @@ $elementList = array();
'2' => $langs->trans('AccountingJournalType2'), '2' => $langs->trans('AccountingJournalType2'),
'3' => $langs->trans('AccountingJournalType3'), '3' => $langs->trans('AccountingJournalType3'),
'4' => $langs->trans('AccountingJournalType4'), '4' => $langs->trans('AccountingJournalType4'),
'5' => $langs->trans('AccountingJournalType5'),
'9' => $langs->trans('AccountingJournalType9') '9' => $langs->trans('AccountingJournalType9')
); );

View File

@ -618,9 +618,10 @@ class Propal extends CommonObject
* @param array $array_options extrafields array * @param array $array_options extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one * @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Unit price in currency * @param double $pu_ht_devise Unit price in currency
* @param int $notrigger disable line update trigger
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_options=0, $fk_unit=null, $pu_ht_devise = 0) function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_options=0, $fk_unit=null, $pu_ht_devise = 0, $notrigger=0)
{ {
global $mysoc; global $mysoc;
@ -745,7 +746,7 @@ class Propal extends CommonObject
$this->line->multicurrency_total_tva = $multicurrency_total_tva; $this->line->multicurrency_total_tva = $multicurrency_total_tva;
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc; $this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
$result=$this->line->update(); $result=$this->line->update($notrigger);
if ($result > 0) if ($result > 0)
{ {
// Reorder if child line // Reorder if child line

View File

@ -2778,9 +2778,10 @@ class Commande extends CommonOrder
* @param array $array_options extrafields array * @param array $array_options extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one * @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Amount in currency * @param double $pu_ht_devise Amount in currency
* @param int $notrigger disable line update trigger
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null, $pu_ht_devise = 0) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null, $pu_ht_devise = 0, $notrigger=0)
{ {
global $conf, $mysoc, $langs, $user; global $conf, $mysoc, $langs, $user;
@ -2935,7 +2936,7 @@ class Commande extends CommonOrder
$this->line->array_options=$array_options; $this->line->array_options=$array_options;
} }
$result=$this->line->update($user); $result=$this->line->update($user, $notrigger);
if ($result > 0) if ($result > 0)
{ {
// Reorder if child line // Reorder if child line

View File

@ -16,9 +16,9 @@
*/ */
/** /**
* \file htdocs/compta/bank/various_payment/index.php * \file htdocs/compta/bank/various_payment/index.php
* \ingroup bank * \ingroup bank
* \brief List of various payments * \brief List of various payments
*/ */
require '../../../main.inc.php'; require '../../../main.inc.php';
@ -44,7 +44,7 @@ $search_account = GETPOST('search_account','int');
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page; $offset = $conf->liste_limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@ -75,7 +75,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_label=""; $search_label="";
$search_amount=""; $search_amount="";
$search_account=''; $search_account='';
$typeid=""; $typeid="";
} }
/* /*
@ -103,11 +103,11 @@ if ($search_label) $sql.=natural_search(array('v.label'), $search_label);
if ($search_amount) $sql.=natural_search("v.amount", $search_amount, 1); if ($search_amount) $sql.=natural_search("v.amount", $search_amount, 1);
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
if ($filtre) { if ($filtre) {
$filtre=str_replace(":","=",$filtre); $filtre=str_replace(":","=",$filtre);
$sql .= " AND ".$filtre; $sql .= " AND ".$filtre;
} }
if ($typeid) { if ($typeid) {
$sql .= " AND v.fk_typepayment=".$typeid; $sql .= " AND v.fk_typepayment=".$typeid;
} }
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
@ -116,48 +116,48 @@ $totalnboflines=0;
$result=$db->query($sql); $result=$db->query($sql);
if ($result) if ($result)
{ {
$totalnboflines = $db->num_rows($result); $totalnboflines = $db->num_rows($result);
} }
$sql.= $db->plimit($limit+1,$offset); $sql.= $db->plimit($limit+1,$offset);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
$total = 0 ; $total = 0 ;
$var=true; $var=true;
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($typeid) $param.='&amp;typeid='.$typeid; if ($typeid) $param.='&amp;typeid='.$typeid;
if ($optioncss != '') $param.='&amp;optioncss='.$optioncss; if ($optioncss != '') $param.='&amp;optioncss='.$optioncss;
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; 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_barre_liste($langs->trans("VariousPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); print_barre_liste($langs->trans("VariousPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
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";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Sens"),$_SERVER["PHP_SELF"],"v.sens","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Sens"),$_SERVER["PHP_SELF"],"v.sens","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Ref // Ref
@ -174,85 +174,85 @@ if ($result)
print '</td>'; print '</td>';
// Account // Account
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$form->select_comptes($search_account,'search_account',0,'',1); $form->select_comptes($search_account,'search_account',0,'',1);
print '</td>'; print '</td>';
} }
// Amount // Amount
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>'; print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
// Sens // Sens
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0); $searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
$variousstatic->id=$obj->rowid; $variousstatic->id=$obj->rowid;
$variousstatic->ref=$obj->rowid; $variousstatic->ref=$obj->rowid;
// Ref // Ref
print "<td>".$variousstatic->getNomUrl(1)."</td>\n"; print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
// Label payment // Label payment
print "<td>".dol_trunc($obj->label,40)."</td>\n"; print "<td>".dol_trunc($obj->label,40)."</td>\n";
// Date payment // Date payment
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
// Type // Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>'; print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
// Account // Account
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
print '<td>'; print '<td>';
if ($obj->fk_bank > 0) if ($obj->fk_bank > 0)
{ {
//$accountstatic->fetch($obj->fk_bank); //$accountstatic->fetch($obj->fk_bank);
$accountstatic->id=$obj->bid; $accountstatic->id=$obj->bid;
$accountstatic->ref=$obj->bref; $accountstatic->ref=$obj->bref;
$accountstatic->number=$obj->bnumber; $accountstatic->number=$obj->bnumber;
$accountstatic->accountancy_number=$obj->account_number; $accountstatic->accountancy_number=$obj->account_number;
$accountstatic->fk_accountancy_journal=$obj->fk_accountancy_journal; $accountstatic->fk_accountancy_journal=$obj->fk_accountancy_journal;
$accountstatic->label=$obj->blabel; $accountstatic->label=$obj->blabel;
print $accountstatic->getNomUrl(1); print $accountstatic->getNomUrl(1);
} }
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
} }
// Amount // Amount
print "<td align=\"right\">".price($obj->amount)."</td>"; print "<td align=\"right\">".price($obj->amount)."</td>";
// Sens // Sens
if ($obj->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit"); if ($obj->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit");
print "<td align=\"right\">".$sens."</td>"; print "<td align=\"right\">".$sens."</td>";
print "<td></td>"; print "<td></td>";
print "</tr>\n"; print "</tr>\n";
$total = $total + $obj->amount; $total = $total + $obj->amount;
$i++; $i++;
} }
$colspan=4; $colspan=4;
if (! empty($conf->banque->enabled)) $colspan++; if (! empty($conf->banque->enabled)) $colspan++;
print '<tr class="liste_total"><td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total" align="right">'.price($total)."</td>"; print '<td class="liste_total" align="right">'.price($total)."</td>";
print "<td></td></tr>"; print "<td></td></tr>";
print "</table>"; print "</table>";
print '</div>'; print '</div>';
print '</form>'; print '</form>';
$db->free($result); $db->free($result);
} }
else else
{ {
dol_print_error($db); dol_print_error($db);
} }

View File

@ -2652,9 +2652,10 @@ class Facture extends CommonInvoice
* @param int $situation_percent Situation advance percentage * @param int $situation_percent Situation advance percentage
* @param string $fk_unit Code of the unit to use. Null to use the default one * @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Unit price in currency * @param double $pu_ht_devise Unit price in currency
* @param int $notrigger disable line update trigger
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=100, $fk_unit = null, $pu_ht_devise = 0) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=100, $fk_unit = null, $pu_ht_devise = 0, $notrigger=0)
{ {
global $conf,$user; global $conf,$user;
// Deprecation warning // Deprecation warning
@ -2812,7 +2813,7 @@ class Facture extends CommonInvoice
$this->line->array_options=$array_options; $this->line->array_options=$array_options;
} }
$result=$this->line->update($user); $result=$this->line->update($user, $notrigger);
if ($result > 0) if ($result > 0)
{ {
// Reorder if child line // Reorder if child line

View File

@ -357,6 +357,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$sql = "SELECT rowid, code, label, nature"; $sql = "SELECT rowid, code, label, nature";
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
$sql.= " WHERE entity = ".$conf->entity; $sql.= " WHERE entity = ".$conf->entity;
$sql.= " active = 1";
$sql.= " ORDER BY label"; $sql.= " ORDER BY label";
$resql = $db->query($sql); $resql = $db->query($sql);
@ -373,10 +374,10 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$nature=''; $nature='';
// Must match array $sourceList defined into journals_list.php // Must match array $sourceList defined into journals_list.php
if ($objp->nature == 2) $nature="sells"; if ($objp->nature == 2 && ! empty($conf->facture->enabled)) $nature="sells";
if ($objp->nature == 3) $nature="purchases"; if ($objp->nature == 3 && ! empty($conf->fournisseur->enabled)) $nature="purchases";
if ($objp->nature == 4) $nature="bank"; if ($objp->nature == 4 && ! empty($conf->banque->enabled)) $nature="bank";
if ($objp->nature == 5) $nature="expensereports"; if ($objp->nature == 5 && ! empty($conf->expensereport->enabled)) $nature="expensereports";
if ($objp->nature == 1) $nature="various"; if ($objp->nature == 1) $nature="various";
if ($objp->nature == 9) $nature="hasnew"; if ($objp->nature == 9) $nature="hasnew";

View File

@ -992,6 +992,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$sql = "SELECT rowid, code, label, nature"; $sql = "SELECT rowid, code, label, nature";
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
$sql.= " WHERE entity = ".$conf->entity; $sql.= " WHERE entity = ".$conf->entity;
$sql.= " AND active = 1";
$sql.= " ORDER BY label"; $sql.= " ORDER BY label";
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -20,7 +20,7 @@
/** /**
* \file htdocs/holiday/list.php * \file htdocs/holiday/list.php
* \ingroup holiday * \ingroup holiday
* \brief List of holiday. * \brief List of holiday
*/ */
require('../main.inc.php'); require('../main.inc.php');
@ -63,10 +63,10 @@ $month_start = GETPOST('month_start');
$year_start = GETPOST('year_start'); $year_start = GETPOST('year_start');
$month_end = GETPOST('month_end'); $month_end = GETPOST('month_end');
$year_end = GETPOST('year_end'); $year_end = GETPOST('year_end');
$search_employe = GETPOST('search_employe'); $search_employee = GETPOST('search_employee');
$search_valideur = GETPOST('search_valideur'); $search_valideur = GETPOST('search_valideur');
$search_statut = GETPOST('select_statut'); $search_statut = GETPOST('select_statut');
$type = GETPOST('type','int'); $search_type = GETPOST('search_type','int');
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
@ -91,10 +91,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$year_start=""; $year_start="";
$month_end=""; $month_end="";
$year_end=""; $year_end="";
$search_employe=""; $search_employee="";
$search_valideur=""; $search_valideur="";
$search_statut=""; $search_statut="";
$type=''; $search_type='';
} }
@ -121,13 +121,13 @@ llxHeader('', $langs->trans('CPTitreMenu'));
$order = $db->order($sortfield,$sortorder).$db->plimit($limit + 1, $offset); $order = $db->order($sortfield,$sortorder).$db->plimit($limit + 1, $offset);
// WHERE // Ref
if(!empty($search_ref)) if(!empty($search_ref))
{ {
$filter.= " AND cp.rowid LIKE '%".$db->escape($search_ref)."%'\n"; $filter.= " AND cp.rowid LIKE '%".$db->escape($search_ref)."%'\n";
} }
// DATE START // Start date
if($year_start > 0) { if($year_start > 0) {
if($month_start > 0) { if($month_start > 0) {
$filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($year_start,$month_start,1))."' AND '".$db->idate(dol_get_last_day($year_start,$month_start,1))."')"; $filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($year_start,$month_start,1))."' AND '".$db->idate(dol_get_last_day($year_start,$month_start,1))."')";
@ -142,7 +142,7 @@ if($year_start > 0) {
} }
} }
// DATE FIN // End date
if($year_end > 0) { if($year_end > 0) {
if($month_end > 0) { if($month_end > 0) {
$filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,$month_end,1))."' AND '".$db->idate(dol_get_last_day($year_end,$month_end,1))."')"; $filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,$month_end,1))."' AND '".$db->idate(dol_get_last_day($year_end,$month_end,1))."')";
@ -157,7 +157,7 @@ if($year_end > 0) {
} }
} }
// DATE CREATE // Create date
if($year_create > 0) { if($year_create > 0) {
if($month_create > 0) { if($month_create > 0) {
$filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($year_create,$month_create,1))."' AND '".$db->idate(dol_get_last_day($year_create,$month_create,1))."')"; $filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($year_create,$month_create,1))."' AND '".$db->idate(dol_get_last_day($year_create,$month_create,1))."')";
@ -172,17 +172,22 @@ if($year_create > 0) {
} }
} }
// EMPLOYE // Employee
if(!empty($search_employe) && $search_employe != -1) { if(!empty($search_employee) && $search_employee != -1) {
$filter.= " AND cp.fk_user = '".$db->escape($search_employe)."'\n"; $filter.= " AND cp.fk_user = '".$db->escape($search_employee)."'\n";
} }
// VALIDEUR // Validator
if(!empty($search_valideur) && $search_valideur != -1) { if(!empty($search_valideur) && $search_valideur != -1) {
$filter.= " AND cp.fk_validator = '".$db->escape($search_valideur)."'\n"; $filter.= " AND cp.fk_validator = '".$db->escape($search_valideur)."'\n";
} }
// STATUT // 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) { if(!empty($search_statut) && $search_statut != -1) {
$filter.= " AND cp.statut = '".$db->escape($search_statut)."'\n"; $filter.= " AND cp.statut = '".$db->escape($search_statut)."'\n";
} }
@ -194,7 +199,6 @@ if (!empty($sall))
if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',',$childids).')'; if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',',$childids).')';
if ($type > 0) $filter.=' AND cp.fk_type IN ('.$db->escape($type).')';
// Récupération de l'ID de l'utilisateur // Récupération de l'ID de l'utilisateur
$user_id = $user->id; $user_id = $user->id;
@ -297,34 +301,34 @@ if ($sall)
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";
// FILTRES // Filters
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
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>';
// DATE CREATE // Create date
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_create" value="'.dol_escape_htmltag($month_create).'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="month_create" value="'.dol_escape_htmltag($month_create).'">';
$formother->select_year($year_create,'year_create',1, $min_year, 0); $formother->select_year($year_create,'year_create',1, $min_year, 0);
print '</td>'; print '</td>';
// UTILISATEUR // User
if ($user->rights->holiday->write_all) if ($user->rights->holiday->write_all)
{ {
print '<td class="liste_titre maxwidthonsmartphone" align="left">'; print '<td class="liste_titre maxwidthonsmartphone" align="left">';
print $form->select_dolusers($search_employe,"search_employe",1,"",0,'','',0,0,0,'',0,'','maxwidth200'); print $form->select_dolusers($search_employee,"search_employee",1,"",0,'','',0,0,0,'',0,'','maxwidth200');
print '</td>'; print '</td>';
} }
else else
{ {
//print '<td class="liste_titre">&nbsp;</td>'; //print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre maxwidthonsmartphone" align="left">'; print '<td class="liste_titre maxwidthonsmartphone" align="left">';
print $form->select_dolusers($user->id,"search_employe",1,"",1,'','',0,0,0,'',0,'','maxwidth200'); print $form->select_dolusers($user->id,"search_employee",1,"",1,'','',0,0,0,'',0,'','maxwidth200');
print '</td>'; print '</td>';
} }
// APPROVER // Approve
if($user->rights->holiday->write_all) if($user->rights->holiday->write_all)
{ {
print '<td class="liste_titre maxwidthonsmartphone" align="left">'; print '<td class="liste_titre maxwidthonsmartphone" align="left">';
@ -352,30 +356,30 @@ foreach($typeleaves as $key => $val)
//$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':'');
$arraytypeleaves[$val['rowid']]=$labeltoshow; $arraytypeleaves[$val['rowid']]=$labeltoshow;
} }
print $form->selectarray('type', $arraytypeleaves, (GETPOST('type')?GETPOST('type'):''), 1); print $form->selectarray('search_type', $arraytypeleaves, (GETPOST('search_type')?GETPOST('search_type'):''), 1);
print '</td>'; print '</td>';
// DUREE // Duration
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
// DATE DEBUT // Start date
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_start" value="'.dol_escape_htmltag($month_start).'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="month_start" value="'.dol_escape_htmltag($month_start).'">';
$formother->select_year($year_start,'year_start',1, $min_year, $max_year); $formother->select_year($year_start,'year_start',1, $min_year, $max_year);
print '</td>'; print '</td>';
// DATE FIN // End date
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.dol_escape_htmltag($month_end).'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.dol_escape_htmltag($month_end).'">';
$formother->select_year($year_end,'year_end',1, $min_year, $max_year); $formother->select_year($year_end,'year_end',1, $min_year, $max_year);
print '</td>'; print '</td>';
// STATUT // Status
print '<td class="liste_titre maxwidthonsmartphone maxwidth200" align="right">'; print '<td class="liste_titre maxwidthonsmartphone maxwidth200" align="right">';
$holiday->selectStatutCP($search_statut); $holiday->selectStatutCP($search_statut);
print '</td>'; print '</td>';
// ACTION // Actions
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0); $searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto; print $searchpicto;
@ -404,7 +408,7 @@ if (! empty($holiday->holiday))
foreach($holiday->holiday as $infos_CP) foreach($holiday->holiday as $infos_CP)
{ {
// Utilisateur // User
$userstatic->id=$infos_CP['fk_user']; $userstatic->id=$infos_CP['fk_user'];
$userstatic->lastname=$infos_CP['user_lastname']; $userstatic->lastname=$infos_CP['user_lastname'];
$userstatic->firstname=$infos_CP['user_firstname']; $userstatic->firstname=$infos_CP['user_firstname'];
@ -412,7 +416,7 @@ if (! empty($holiday->holiday))
$userstatic->statut=$infos_CP['user_statut']; $userstatic->statut=$infos_CP['user_statut'];
$userstatic->photo=$infos_CP['user_photo']; $userstatic->photo=$infos_CP['user_photo'];
// Valideur // Validator
$approbatorstatic->id=$infos_CP['fk_validator']; $approbatorstatic->id=$infos_CP['fk_validator'];
$approbatorstatic->lastname=$infos_CP['validator_lastname']; $approbatorstatic->lastname=$infos_CP['validator_lastname'];
$approbatorstatic->firstname=$infos_CP['validator_firstname']; $approbatorstatic->firstname=$infos_CP['validator_firstname'];