diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 72cd1ad5124..9dd04ca1ea6 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -627,8 +627,8 @@ if ($action == 'exportcsv') { print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - print '"' . $langs->trans("Code_tiers") . '"' . $sep; - print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; + print '"' . $langs->trans("Thirdparty") . '"' . $sep; + print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Thirdparty") . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep; print '"' . $journal . '"' ; @@ -694,7 +694,7 @@ if ($action == 'exportcsv') { print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - print '"' . $langs->trans("Code_tiers") . '"' . $sep; + print '"' . $langs->trans("Thirdparty") . '"' . $sep; print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index c10cc2b311f..f56d5c9010e 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -578,8 +578,8 @@ if ($action == 'exportcsv') { print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - print '"' . $langs->trans("Code_tiers") . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; + print '"' . $langs->trans("Thirdparty") . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Thirdparty") . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . $journal . '"'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7b940e35378..23758a1de5e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1457,7 +1457,7 @@ class Form * @param int $force_entity 0 or Id of environment to force * @param int $maxlength Maximum length of string into list (0=no limit) * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status - * @param string $morefilter Add more filters into sql request + * @param string $morefilter Add more filters into sql request (Example: 'employee = 1') * @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list * @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty. * @param string $morecss More css @@ -1530,7 +1530,6 @@ class Form $sql.= " ORDER BY u.lastname ASC"; } - dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 20a9b85cf86..3d92d5f9019 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -738,6 +738,10 @@ class Ldap */ function serverPing($host, $port=389, $timeout=1) { + // Replace ldaps:// by ssl:// + if (preg_match('/^ldaps:\/\/([^\/]+)\/?$/',$host, $regs)) { + $host = 'ssl://'.$regs[1]; + } $op = @fsockopen($host, $port, $errno, $errstr, $timeout); if (!$op) return false; //DC is N/A else { diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 1e5b8d183e4..e7773e08de4 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -593,7 +593,7 @@ if (empty($reshook)) // FROM $expediteur = new User($db); - $expediteur->fetch($object->fk_user_valid); + $expediteur->fetch($object->fk_user_approve > 0 ? $object->fk_user_approve : $object->fk_user_validator); $emailFrom = $expediteur->email; if ($emailFrom && $emailTo) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 6c197b16e01..c3a6b2341f1 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -44,7 +44,6 @@ class ExpenseReport extends CommonObject public $date_fin; - var $fk_user_validator; var $status; var $fk_statut; // -- 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied var $fk_c_paiement; @@ -78,14 +77,16 @@ class ExpenseReport extends CommonObject var $detail_cancel; var $fk_user_cancel; + var $fk_user_validator; // User that is defined to approve + // Validation - var $date_valid; + var $date_valid; // User making validation var $fk_user_valid; var $user_valid_infos; // Approve var $date_approve; - var $fk_user_approve; + var $fk_user_approve; // User that has approved // Paiement var $user_paid_infos; @@ -179,6 +180,7 @@ class ExpenseReport extends CommonObject $sql.= ",date_create"; $sql.= ",fk_user_author"; $sql.= ",fk_user_validator"; + $sql.= ",fk_user_approve"; $sql.= ",fk_user_modif"; $sql.= ",fk_statut"; $sql.= ",fk_c_paiement"; @@ -196,6 +198,7 @@ class ExpenseReport extends CommonObject $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", ".$fuserid; $sql.= ", ".($this->fk_user_validator > 0 ? $this->fk_user_validator:"null"); + $sql.= ", ".($this->fk_user_approve > 0 ? $this->fk_user_approve:"null"); $sql.= ", ".($this->fk_user_modif > 0 ? $this->fk_user_modif:"null"); $sql.= ", ".($this->fk_statut > 1 ? $this->fk_statut:0); $sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null"); @@ -386,6 +389,7 @@ class ExpenseReport extends CommonObject } $sql.= " , fk_user_validator = ".($this->fk_user_validator > 0 ? $this->fk_user_validator:"null"); $sql.= " , fk_user_valid = ".($this->fk_user_valid > 0 ? $this->fk_user_valid:"null"); + $sql.= " , fk_user_approve = ".($this->fk_user_approve > 0 ? $this->fk_user_approve:"null"); $sql.= " , fk_user_modif = ".$user->id; $sql.= " , fk_statut = ".($this->fk_statut >= 0 ? $this->fk_statut:'0'); $sql.= " , fk_c_paiement = ".($this->fk_c_paiement > 0 ? $this->fk_c_paiement:"null"); @@ -495,7 +499,8 @@ class ExpenseReport extends CommonObject $this->user_author_infos = dolGetFirstLastname($user_author->firstname, $user_author->lastname); $user_approver = new User($this->db); - if ($this->fk_user_validator > 0) $user_approver->fetch($this->fk_user_validator); + if ($this->fk_user_approve > 0) $user_approver->fetch($this->fk_user_approve); + elseif ($this->fk_user_validator > 0) $user_approver->fetch($this->fk_user_validator); // For backward compatibility $this->user_validator_infos = dolGetFirstLastname($user_approver->firstname, $user_approver->lastname); $this->fk_statut = $obj->status; @@ -744,9 +749,9 @@ class ExpenseReport extends CommonObject $this->fk_statut = 5; $this->fk_user_author = $user->id; + $this->fk_user_validator = $user->id; $this->fk_user_valid = $user->id; $this->fk_user_approve = $user->id; - $this->fk_user_validator = $user->id; $this->note_private='Private note'; $this->note_public='SPECIMEN'; diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 59cb522d7d5..799b0907a92 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -814,21 +814,27 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print '
'."\n"; print ''."\n"; - dol_fiche_head('', '', '', -1); + if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) + { + dol_fiche_head('', '', '', -1); - $out=''; - $typeleaves=$object->getTypes(1,1); - foreach($typeleaves as $key => $val) - { - $nb_type = $object->getCPforUser($user->id, $val['rowid']); - $nb_holiday += $nb_type; - $out .= ' - '.$val['label'].': '.($nb_type?price2num($nb_type):0).'
'; - } - print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'
'; - print $out; - - dol_fiche_end(); + $out=''; + $typeleaves=$object->getTypes(1,1); + foreach($typeleaves as $key => $val) + { + $nb_type = $object->getCPforUser($user->id, $val['rowid']); + $nb_holiday += $nb_type; + $out .= ' - '.$val['label'].': '.($nb_type?price2num($nb_type):0).'
'; + } + print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'
'; + print $out; + dol_fiche_end(); + } + elseif(! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) + { + print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'
'; + } dol_fiche_head(); @@ -846,7 +852,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print $form->select_dolusers($fuserid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print ''; } - else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id,'fuserid',0,'',0); + else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, 'AND employee = 1'); print ''; print ''; @@ -858,11 +864,11 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create $arraytypeleaves=array(); foreach($typeleaves as $key => $val) { - $labeltoshow = $val['label']; + $labeltoshow = ($langs->trans($val['code'])!=$val['code'] ? $langs->trans($val['code']) : $val['label']); $labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); $arraytypeleaves[$val['rowid']]=$labeltoshow; } - print $form->selectarray('type', $arraytypeleaves, (GETPOST('type')?GETPOST('type'):''), 1); + print $form->selectarray('type', $arraytypeleaves, (GETPOST('type','alpha')?GETPOST('type','alpha'):''), 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''; print ''; @@ -878,11 +884,11 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create if (! GETPOST('date_debut_')) { $form->select_date(-1, 'date_debut_', 0, 0, 0, '', 1, 1); } else { - $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); + $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_debut_month','int'), GETPOST('date_debut_day','int'), GETPOST('date_debut_year','int')); $form->select_date($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1); } print '     '; - print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):'morning')); + print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday','alpha')?GETPOST('starthalfday','alpha'):'morning')); print ''; print ''; @@ -897,11 +903,11 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create if (! GETPOST('date_fin_')) { $form->select_date(-1,'date_fin_', 0, 0, 0, '', 1, 1); } else { - $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); + $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_fin_month','int'), GETPOST('date_fin_day','int'), GETPOST('date_fin_year','int')); $form->select_date($tmpdate,'date_fin_', 0, 0, 0, '', 1, 1); } print '     '; - print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):'afternoon')); + print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday','alpha')?GETPOST('endhalfday','alpha'):'afternoon')); print ''; print ''; @@ -909,7 +915,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print ''; print ''.$langs->trans("ReviewedByCP").''; print ''; - print $form->select_dolusers((GETPOST('valideur')>0?GETPOST('valideur'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent + print $form->select_dolusers((GETPOST('valideur','int')>0?GETPOST('valideur','int'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent print ''; print ''; @@ -917,7 +923,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print ''; print ''.$langs->trans("DescCP").''; print ''; - $doleditor = new DolEditor('description', GETPOST('description'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + $doleditor = new DolEditor('description', GETPOST('description','none'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); print ''; @@ -1076,7 +1082,8 @@ else print ''.$langs->trans("Type").''; print ''; $typeleaves=$object->getTypes(1,-1); - print empty($typeleaves[$object->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved",$object->fk_type) : $typeleaves[$object->fk_type]['label']; + $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code'])!=$typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']); + print empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved",$object->fk_type) : $labeltoshow; print ''; print ''; @@ -1086,7 +1093,7 @@ else if(!$edit) { print ''; - print ''.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; + print ''.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; print ''.dol_print_date($object->date_debut,'day'); print '     '; print ''.$langs->trans($listhalfday[$starthalfday]).''; @@ -1096,7 +1103,7 @@ else else { print ''; - print ''.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; + print ''.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; print ''; $form->select_date($object->date_debut,'date_debut_'); print '     '; @@ -1108,7 +1115,7 @@ else if (!$edit) { print ''; - print ''.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; + print ''.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; print ''.dol_print_date($object->date_fin,'day'); print '     '; print ''.$langs->trans($listhalfday[$endhalfday]).''; @@ -1118,7 +1125,7 @@ else else { print ''; - print ''.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; + print ''.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; print ''; $form->select_date($object->date_fin,'date_fin_'); print '     '; @@ -1183,11 +1190,14 @@ else // Validator if (!$edit) { print ''; - print ''.$langs->trans('ReviewedByCP').''; + print ''; + if ($object->statut == 3 || $object->statut == 4) print $langs->trans('ApprovedBy'); + else print $langs->trans('ReviewedByCP'); + print ''; print ''.$valideur->getNomUrl(-1).''; print ''; } else { - print ''; + print ''; print ''.$langs->trans('ReviewedByCP').''; print ''; print $form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id))); // By default, hierarchical parent @@ -1199,10 +1209,10 @@ else print ''.$langs->trans('DateCreateCP').''; print ''.dol_print_date($object->date_create,'dayhour').''; print ''; - if ($object->statut == 3) { + if ($object->statut == 3 || $object->statut == 4) { print ''; print ''.$langs->trans('DateValidCP').''; - print ''.dol_print_date($object->date_valid,'dayhour').''; + print ''.dol_print_date($object->date_valid,'dayhour').''; // warning: date_valid is approval date on holiday module print ''; } if ($object->statut == 4) { diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 26551847772..6e230fac7b2 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -957,10 +957,11 @@ class Holiday extends CommonObject /** * Affiche un select HTML des statuts de congés payés * - * @param int $selected int du statut séléctionné par défaut - * @return string affiche le select des statuts + * @param int $selected Id of preselected status + * @param string $select_statut Name of HTML select field + * @return string Show select of status */ - function selectStatutCP($selected='') { + function selectStatutCP($selected='', $htmlname='select_statut') { global $langs; @@ -969,7 +970,7 @@ class Holiday extends CommonObject $nb = count($name)+1; // Select HTML - $statut = ''."\n"; $statut.= ''."\n"; // Boucle des statuts diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 4bc17e026df..6b2a84fad38 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -286,7 +286,8 @@ else { foreach($typeleaves as $key => $val) { - print_liste_field_titre($val['label'], $_SERVER["PHP_SELF"], '', '', '', 'align="center"'); + $labeltype = ($langs->trans($val['code'])!=$val['code']) ? $langs->trans($val['code']) : $langs->trans($val['label']); + print_liste_field_titre($labeltype, $_SERVER["PHP_SELF"], '', '', '', 'align="center"'); } } else diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index cf81d0a98fa..e0894ecb355 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -73,18 +73,21 @@ if (! $sortorder) $sortorder="DESC"; $id = GETPOST('id','int'); -$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); -$search_ref = GETPOST('search_ref'); -$month_create = GETPOST('month_create'); -$year_create = GETPOST('year_create'); -$month_start = GETPOST('month_start'); -$year_start = GETPOST('year_start'); -$month_end = GETPOST('month_end'); -$year_end = GETPOST('year_end'); -$search_employee = GETPOST('search_employee'); -$search_valideur = GETPOST('search_valideur'); -$search_statut = GETPOST('select_statut'); -$search_type = GETPOST('search_type','int'); +$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); +$search_ref = GETPOST('search_ref','alpha'); +$search_day_create = GETPOST('search_day_create','int'); +$search_month_create = GETPOST('search_month_create','int'); +$search_year_create = GETPOST('search_year_create','int'); +$search_day_start = GETPOST('search_day_start','int'); +$search_month_start = GETPOST('search_month_start','int'); +$search_year_start = GETPOST('search_year_start','int'); +$search_day_end = GETPOST('search_day_end','int'); +$search_month_end = GETPOST('search_month_end','int'); +$search_year_end = GETPOST('search_year_end','int'); +$search_employee = GETPOST('search_employee','int'); +$search_valideur = GETPOST('search_valideur','int'); +$search_statut = GETPOST('search_statut','int'); +$search_type = GETPOST('search_type','int'); // List of fields to search into when doing a "search in all" $fieldstosearchall = array( @@ -115,12 +118,12 @@ if (empty($reshook)) 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=""; - $month_create=""; - $year_create=""; - $month_start=""; - $year_start=""; - $month_end=""; - $year_end=""; + $search_month_create=""; + $search_year_create=""; + $search_month_start=""; + $search_year_start=""; + $search_month_end=""; + $search_year_end=""; $search_employee=""; $search_valideur=""; $search_statut=""; @@ -178,47 +181,47 @@ if(!empty($search_ref)) } // Start date -if($year_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 date_format(cp.date_debut, '%Y-%m') = '$year_start-$month_start'"; +if($search_year_start > 0) { + if($search_month_start > 0) { + $filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($search_year_start,$search_month_start,1))."' AND '".$db->idate(dol_get_last_day($search_year_start,$search_month_start,1))."')"; + //$filter.= " AND date_format(cp.date_debut, '%Y-%m') = '$search_year_start-$search_month_start'"; } else { - $filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($year_start,1,1))."' AND '".$db->idate(dol_get_last_day($year_start,12,1))."')"; - //$filter.= " AND date_format(cp.date_debut, '%Y') = '$year_start'"; + $filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($search_year_start,1,1))."' AND '".$db->idate(dol_get_last_day($search_year_start,12,1))."')"; + //$filter.= " AND date_format(cp.date_debut, '%Y') = '$search_year_start'"; } } else { - if($month_start > 0) { - $filter.= " AND date_format(cp.date_debut, '%m') = '".$db->escape($month_start)."'"; + if($search_month_start > 0) { + $filter.= " AND date_format(cp.date_debut, '%m') = '".$db->escape($search_month_start)."'"; } } // End date -if($year_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 date_format(cp.date_fin, '%Y-%m') = '$year_end-$month_end'"; +if($search_year_end > 0) { + if($search_month_end > 0) { + $filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($search_year_end,$search_month_end,1))."' AND '".$db->idate(dol_get_last_day($search_year_end,$search_month_end,1))."')"; + //$filter.= " AND date_format(cp.date_fin, '%Y-%m') = '$search_year_end-$search_month_end'"; } else { - $filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,1,1))."' AND '".$db->idate(dol_get_last_day($year_end,12,1))."')"; - //$filter.= " AND date_format(cp.date_fin, '%Y') = '$year_end'"; + $filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($search_year_end,1,1))."' AND '".$db->idate(dol_get_last_day($search_year_end,12,1))."')"; + //$filter.= " AND date_format(cp.date_fin, '%Y') = '$search_year_end'"; } } else { - if($month_end > 0) { - $filter.= " AND date_format(cp.date_fin, '%m') = '".$db->escape($month_end)."'"; + if($search_month_end > 0) { + $filter.= " AND date_format(cp.date_fin, '%m') = '".$db->escape($search_month_end)."'"; } } // Create date -if($year_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 date_format(cp.date_create, '%Y-%m') = '$year_create-$month_create'"; +if($search_year_create > 0) { + if($search_month_create > 0) { + $filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($search_year_create,$search_month_create,1))."' AND '".$db->idate(dol_get_last_day($search_year_create,$search_month_create,1))."')"; + //$filter.= " AND date_format(cp.date_create, '%Y-%m') = '$search_year_create-$search_month_create'"; } else { - $filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($year_create,1,1))."' AND '".$db->idate(dol_get_last_day($year_create,12,1))."')"; - //$filter.= " AND date_format(cp.date_create, '%Y') = '$year_create'"; + $filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($search_year_create,1,1))."' AND '".$db->idate(dol_get_last_day($search_year_create,12,1))."')"; + //$filter.= " AND date_format(cp.date_create, '%Y') = '$search_year_create'"; } } else { - if($month_create > 0) { - $filter.= " AND date_format(cp.date_create, '%m') = '".$db->escape($month_create)."'"; + if($search_month_create > 0) { + $filter.= " AND date_format(cp.date_create, '%m') = '".$db->escape($search_month_create)."'"; } } @@ -289,9 +292,23 @@ $num = count($holiday->holiday); $arrayofselected=is_array($toselect)?$toselect:array(); $param=''; -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; -if ($optioncss != '') $param.='&optioncss='.$optioncss; +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_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_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); // List of mass actions available $arrayofmassactions = array( @@ -380,8 +397,8 @@ print ''; // Create date print ''; -print ''; -$formother->select_year($year_create,'year_create',1, $min_year, 0); +print ''; +$formother->select_year($search_year_create,'search_year_create',1, $min_year, 0); print ''; // User @@ -423,7 +440,7 @@ $typeleaves=$holidaystatic->getTypes(1,-1); $arraytypeleaves=array(); foreach($typeleaves as $key => $val) { - $labeltoshow = $val['label']; + $labeltoshow = ($langs->trans($val['code'])!=$val['code'] ? $langs->trans($val['code']) : $val['label']); //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); $arraytypeleaves[$val['rowid']]=$labeltoshow; } @@ -435,19 +452,19 @@ print ' '; // Start date print ''; -print ''; -$formother->select_year($year_start,'year_start',1, $min_year, $max_year); +print ''; +$formother->select_year($search_year_start,'search_year_start',1, $min_year, $max_year); print ''; // End date print ''; -print ''; -$formother->select_year($year_end,'year_end',1, $min_year, $max_year); +print ''; +$formother->select_year($search_year_end,'search_year_end',1, $min_year, $max_year); print ''; // Status print ''; -$holiday->selectStatutCP($search_statut); +$holiday->selectStatutCP($search_statut, 'search_statut'); print ''; // Actions @@ -468,7 +485,7 @@ print_liste_field_titre("Duration",$_SERVER["PHP_SELF"],'','',$pram,'align="righ print_liste_field_titre("DateDebCP",$_SERVER["PHP_SELF"],"cp.date_debut","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("DateFinCP",$_SERVER["PHP_SELF"],"cp.date_fin","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"cp.statut","",$param,'align="right"',$sortfield,$sortorder); -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'',$param,'align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; print "\n"; $listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon")); @@ -516,7 +533,8 @@ if (! empty($holiday->holiday)) print ''.$userstatic->getNomUrl(-1, 'leave').''; print ''.$approbatorstatic->getNomUrl(-1).''; print ''; - print empty($typeleaves[$infos_CP['fk_type']]['label']) ? $langs->trans("TypeWasDisabledOrRemoved",$infos_CP['fk_type']) : $typeleaves[$infos_CP['fk_type']]['label']; + $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']); + print empty($typeleaves[$infos_CP['fk_type']]['label']) ? $langs->trans("TypeWasDisabledOrRemoved",$infos_CP['fk_type']) : $labeltypeleavetoshow; print ''; print ''; $nbopenedday=num_open_day($infos_CP['date_debut_gmt'], $infos_CP['date_fin_gmt'], 0, 1, $infos_CP['halfday']); diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 69bd6b6a190..d67db73d437 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -117,7 +117,7 @@ foreach($cp->logs as $logs_CP) print ''.$user_update->getNomUrl(-1).''; print ''.$logs_CP['type_action'].''; print ''; - $label=$alltypeleaves[$logs_CP['fk_type']]['label']; + $label = (($alltypeleaves[$logs_CP['fk_type']]['code'] && $langs->trans($alltypeleaves[$logs_CP['fk_type']]['code'])!=$alltypeleaves[$logs_CP['fk_type']]['code']) ? $langs->trans($alltypeleaves[$logs_CP['fk_type']]['code']) : $alltypeleaves[$logs_CP['fk_type']]['label']); print $label?$label:$logs_CP['fk_type']; print ''; print ''.price2num($logs_CP['prev_solde'],5).' '.$langs->trans('days').''; diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index f0e279bb848..2f360dce5c5 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -130,27 +130,34 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele if (! empty($conf->holiday->enabled)) { - $user_id = $user->id; + if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) + { + $user_id = $user->id; - print ''; - print ''; - print ""; - print ''; + print ''; + print '
'.$langs->trans("Holidays").'
'; + print ''; + print ''; + print ""; + print ''; - print ''; - print '
'.$langs->trans("Holidays").'
'; - $out=''; - $typeleaves=$holiday->getTypes(1,1); - foreach($typeleaves as $key => $val) - { - $nb_type = $holiday->getCPforUser($user->id, $val['rowid']); - $nb_holiday += $nb_type; - $out .= ' - '.$val['label'].': '.($nb_type?price2num($nb_type):0).'
'; - } - print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'
'; - print $out; + $out=''; + $typeleaves=$holiday->getTypes(1,1); + foreach($typeleaves as $key => $val) + { + $nb_type = $holiday->getCPforUser($user->id, $val['rowid']); + $nb_holiday += $nb_type; + $out .= ' - '.$val['label'].': '.($nb_type?price2num($nb_type):0).'
'; + } + print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'
'; + print $out; - print '

'; + print '

'; + } + elseif (! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) + { + print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'
'; + } } diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index d1f7e3eb31a..aa6e1f3e3c1 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -189,6 +189,8 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) else dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities } + + dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO); } // Create user used to create the admin user diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 28a77095084..22724acfc09 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -149,7 +149,6 @@ ACCOUNTING_SERVICE_SOLD_ACCOUNT=Accounting account by default for the sold servi Doctype=Type of document Docdate=Date Docref=Reference -Code_tiers=Thirdparty LabelAccount=Label account LabelOperation=Label operation Sens=Sens @@ -180,7 +179,7 @@ ProductAccountNotDefined=Account for product not defined FeeAccountNotDefined=Account for fee not defined BankAccountNotDefined=Account for bank not defined CustomerInvoicePayment=Payment of invoice customer -ThirdPartyAccount=Thirdparty account +ThirdPartyAccount=Third party account NewAccountingMvt=New transaction NumMvts=Numero of transaction ListeMvts=List of movements diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index f73bbdeee52..3c834cc57cd 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -91,7 +91,10 @@ LastHolidays=Latest %s leave requests AllHolidays=All leave requests HalfDay=Half day NotTheAssignedApprover=You are not the assigned approver - +LEAVE_PAID=Paid vacation +LEAVE_SICK=Sick leave +LEAVE_OTHER=Other leave +LEAVE_PAID_FR=Paid vacation ## Configuration du Module ## LastUpdateCP=Latest automatic update of leaves allocation MonthOfLastMonthlyUpdate=Month of latest automatic update of leaves allocation diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index 2b254bf91e7..0f9fcac1d02 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -21,17 +21,17 @@ ListToApprove=Waiting for approval ExpensesArea=Expense reports area ClassifyRefunded=Classify 'Refunded' ExpenseReportWaitingForApproval=A new expense report has been submitted for approval -ExpenseReportWaitingForApprovalMessage=A new expense report has been submitted and is waiting for approval.\n - User: %s\n - Period: %s\nClick here to validate: %s +ExpenseReportWaitingForApprovalMessage=A new expense report has been submitted and is waiting for approval.
- User: %s
- Period: %s
Click here to validate: %s ExpenseReportWaitingForReApproval=An expense report has been submitted for re-approval -ExpenseReportWaitingForReApprovalMessage=An expense report has been submitted and is waiting for re-approval.\nThe %s, you refused to approve the expense report for this reason: %s.\nA new version has been proposed and waiting for your approval.\n - User: %s\n - Period: %s\nClick here to validate: %s +ExpenseReportWaitingForReApprovalMessage=An expense report has been submitted and is waiting for re-approval.
The %s, you refused to approve the expense report for this reason: %s.
A new version has been proposed and waiting for your approval.
- User: %s
- Period: %s
Click here to validate: %s ExpenseReportApproved=An expense report was approved -ExpenseReportApprovedMessage=The expense report %s was approved.\n - User: %s\n - Approved by: %s\nClick here to show the expense report: %s +ExpenseReportApprovedMessage=The expense report %s was approved.
- User: %s
- Approved by: %s
Click here to show the expense report: %s ExpenseReportRefused=An expense report was refused -ExpenseReportRefusedMessage=The expense report %s was refused.\n - User: %s\n - Refused by: %s\n - Motive for refusal: %s\nClick here to show the expense report: %s +ExpenseReportRefusedMessage=The expense report %s was refused.
- User: %s
- Refused by: %s
- Motive for refusal: %s
Click here to show the expense report: %s ExpenseReportCanceled=An expense report was canceled -ExpenseReportCanceledMessage=The expense report %s was canceled.\n - User: %s\n - Canceled by: %s\n - Motive for cancellation: %s\nClick here to show the expense report: %s +ExpenseReportCanceledMessage=The expense report %s was canceled.
- User: %s
- Canceled by: %s
- Motive for cancellation: %s
Click here to show the expense report: %s ExpenseReportPaid=An expense report was paid -ExpenseReportPaidMessage=The expense report %s was paid.\n - User: %s\n - Paid by: %s\nClick here to show the expense report: %s +ExpenseReportPaidMessage=The expense report %s was paid.
- User: %s
- Paid by: %s
Click here to show the expense report: %s TripId=Id expense report AnyOtherInThisListCanValidate=Person to inform for validation. TripSociete=Information company diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 28afacba39f..ba200ddcfb0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -648,45 +648,13 @@ class Project extends CommonObject } } - // Delete tasks - if (! $error) - { - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_time"; - $sql.= " WHERE fk_task IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task WHERE fk_projet=" . $this->id . ")"; + // Fetch tasks + $this->getLinesArray($user); - $resql = $this->db->query($sql); - if (!$resql) - { - $this->errors[] = $this->db->lasterror(); - $error++; - } - } - - if (! $error) - { - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_extrafields"; - $sql.= " WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task WHERE fk_projet=" . $this->id . ")"; - - $resql = $this->db->query($sql); - if (!$resql) - { - $this->errors[] = $this->db->lasterror(); - $error++; - } - } - - if (! $error) - { - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task"; - $sql.= " WHERE fk_projet=" . $this->id; - - $resql = $this->db->query($sql); - if (!$resql) - { - $this->errors[] = $this->db->lasterror(); - $error++; - } - } + // Delete tasks + foreach($this->lines as &$task) { + $task->delete($user); + } // Delete project if (! $error) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 157fa85e77d..d266094b53b 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -278,7 +278,9 @@ input.select2-input { .liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], -.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when] { +.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], +.liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end] +{ margin-right: 4px; } input[type=submit] { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5b8d82aaa53..88ef5d5caaa 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -291,7 +291,9 @@ textarea.cke_source:focus .liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], -.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when] { +.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], +.liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end] +{ margin-right: 4px; } input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {