diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php index 9007ef5ad91..2cf3a323c21 100644 --- a/htdocs/admin/agenda_extrafields.php +++ b/htdocs/admin/agenda_extrafields.php @@ -93,7 +93,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -107,7 +107,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/admin/bank_extrafields.php b/htdocs/admin/bank_extrafields.php index 849cbd9f485..2d03c51e34d 100644 --- a/htdocs/admin/bank_extrafields.php +++ b/htdocs/admin/bank_extrafields.php @@ -89,7 +89,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel +/* Creation of an optional field /* */ /* ************************************************************************** */ @@ -103,7 +103,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/admin/expedition_extrafields.php b/htdocs/admin/expedition_extrafields.php index 7db9a8f2526..d682f73ce6d 100644 --- a/htdocs/admin/expedition_extrafields.php +++ b/htdocs/admin/expedition_extrafields.php @@ -96,7 +96,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -110,7 +110,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/admin/expeditiondet_extrafields.php b/htdocs/admin/expeditiondet_extrafields.php index caddf621db5..c4d45f08ded 100644 --- a/htdocs/admin/expeditiondet_extrafields.php +++ b/htdocs/admin/expeditiondet_extrafields.php @@ -96,7 +96,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -110,7 +110,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/admin/livraison_extrafields.php b/htdocs/admin/livraison_extrafields.php index a236e4954cf..71a34039084 100644 --- a/htdocs/admin/livraison_extrafields.php +++ b/htdocs/admin/livraison_extrafields.php @@ -96,7 +96,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -110,7 +110,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/admin/livraisondet_extrafields.php b/htdocs/admin/livraisondet_extrafields.php index ffa00ecf2be..4679123352a 100644 --- a/htdocs/admin/livraisondet_extrafields.php +++ b/htdocs/admin/livraisondet_extrafields.php @@ -96,7 +96,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -110,7 +110,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index ea0f99021cf..5d7358ae051 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -93,7 +93,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -107,7 +107,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index 8a9f0e52c0a..f966af78bf3 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -108,7 +108,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index 315a88788c2..701362e38f4 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -97,7 +97,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -111,7 +111,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/admin/supplierinvoicedet_extrafields.php b/htdocs/admin/supplierinvoicedet_extrafields.php index 7e0f0f500fd..e741eb6cd75 100644 --- a/htdocs/admin/supplierinvoicedet_extrafields.php +++ b/htdocs/admin/supplierinvoicedet_extrafields.php @@ -97,7 +97,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -111,7 +111,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index 4dbb8f54760..00550995d19 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -93,7 +93,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -107,7 +107,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/admin/supplierorderdet_extrafields.php b/htdocs/admin/supplierorderdet_extrafields.php index 8518c77a8e4..f83ad1348fc 100644 --- a/htdocs/admin/supplierorderdet_extrafields.php +++ b/htdocs/admin/supplierorderdet_extrafields.php @@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -108,7 +108,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php index 87e907c696e..2bc9f205334 100644 --- a/htdocs/categories/admin/categorie_extrafields.php +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -86,8 +86,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -100,7 +100,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php index 9c55c606e81..784512d6d1e 100644 --- a/htdocs/comm/admin/propal_extrafields.php +++ b/htdocs/comm/admin/propal_extrafields.php @@ -87,8 +87,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -101,7 +101,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php index 97d4763ace3..633c4fab581 100644 --- a/htdocs/comm/admin/propaldet_extrafields.php +++ b/htdocs/comm/admin/propaldet_extrafields.php @@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -108,7 +108,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php index 627ff82ae41..ae545c695c3 100644 --- a/htdocs/compta/facture/admin/facture_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php @@ -87,9 +87,9 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ -/* */ -/* Creation d'un champ optionnel -/* */ +/* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -101,9 +101,9 @@ if ($action == 'create') } /* ************************************************************************** */ -/* */ -/* Edition d'un champ optionnel */ -/* */ +/* */ +/* Edition of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { diff --git a/htdocs/compta/hrm.php b/htdocs/compta/hrm.php index 4122f850723..d4639947529 100644 --- a/htdocs/compta/hrm.php +++ b/htdocs/compta/hrm.php @@ -140,7 +140,82 @@ $max=10; $langs->load("boxes"); -// Last trips + + +// Last expense report (new module) +if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) +{ + $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status"; + $sql.= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; + $sql.= " WHERE u.rowid = x.fk_user"; + $sql.= " AND x.entity = ".$conf->entity; + if (empty($user->rights->holiday->read_all)) $sql.=' AND x.fk_user IN ('.join(',',$childids).')'; + //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + //if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid; + $sql.= $db->order("x.tms","DESC"); + $sql.= $db->plimit($max, 0); + + $result = $db->query($sql); + if ($result) + { + $var=false; + $num = $db->num_rows($result); + + $holidaystatic=new Holiday($db); + $userstatic=new User($db); + + $listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon")); + $typeleaves=$holidaystatic->getTypes(1,-1); + + $i = 0; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($num) + { + while ($i < $num && $i < $max) + { + $obj = $db->fetch_object($result); + $holidaystatic->id=$obj->rowid; + $holidaystatic->ref=$obj->ref; + $userstatic->id=$obj->uid; + $userstatic->lastname=$obj->lastname; + $userstatic->firstname=$obj->firstname; + print ''; + print ''; + print ''; + print ''; + + $starthalfday=($obj->halfday == -1 || $obj->halfday == 2)?'afternoon':'morning'; + $endhalfday=($obj->halfday == 1 || $obj->halfday == 2)?'morning':'afternoon'; + + print ''; + print ''; + print ''; + $var=!$var; + $i++; + } + + } + else + { + print ''; + } + print '
'.$langs->trans("BoxTitleLastLeaveRequests",min($max,$num)).''.$langs->trans("from").''.$langs->trans("to").''.$langs->trans("DateModificationShort").' 
'.$holidaystatic->getNomUrl(1).''.$userstatic->getNomUrl(1).''.$typeleaves[$obj->fk_type]['label'].''.dol_print_date($obj->date_start,'day').' '.$langs->trans($listhalfday[$endhalfday]); + print ''.dol_print_date($obj->date_end,'day').' '.$langs->trans($listhalfday[$endhalfday]); + print ''.dol_print_date($db->jdate($obj->dm),'day').''.$holidaystatic->LibStatut($obj->status,3).'
'.$langs->trans("None").'

'; + } + else dol_print_error($db); +} + + +// Last expense report (old module) if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut"; @@ -204,6 +279,7 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) else dol_print_error($db); } +// Last expense report (new module) if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 7e94a1f5448..f9a822fdfc8 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -376,7 +376,7 @@ class Paiement extends CommonObject if (! $notrigger) { // Appel des triggers - $result=$this->call_trigger('PAYMENT_DELETE', $user); + $result=$this->call_trigger('PAYMENT_CUSTOMER_DELETE', $user); if ($result < 0) { $this->db->rollback(); diff --git a/htdocs/contrat/admin/contract_extrafields.php b/htdocs/contrat/admin/contract_extrafields.php index 9711379f458..a5a86efaad9 100644 --- a/htdocs/contrat/admin/contract_extrafields.php +++ b/htdocs/contrat/admin/contract_extrafields.php @@ -90,8 +90,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -104,7 +104,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 384e30f8b12..d314af73cd1 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -25,6 +25,7 @@ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); + /** * Class to manage the box to show last task */ @@ -36,6 +37,7 @@ class box_task extends ModeleBoxes //var $depends = array("projet"); var $db; var $param; + var $enabled = 0; // Disabled because bugged. var $info_box_head = array(); var $info_box_contents = array(); @@ -79,8 +81,8 @@ class box_task extends ModeleBoxes // list the summary of the orders if ($user->rights->projet->lire) { - - $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot"; + // FIXME fk_statut on a task is not be used. We use the percent. This means this box is useless. + $sql = "SELECT pt.fk_statut, count(DISTINCT pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt"; $sql.= " WHERE pt.datec BETWEEN '".$this->db->idate(dol_get_first_day(date("Y"), 1))."' AND '".$this->db->idate(dol_get_last_day(date("Y"), 12))."'"; $sql.= " AND pt.rowid = ptt.fk_task"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bcdcdea6147..d4f0a1e4691 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1016,6 +1016,7 @@ class Form // Do not use textempty = ' ' or ' ' here, or search on key will search on ' key'. //$textifempty=' '; //if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; + if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) $textifempty.=$langs->trans("NoFilter"); if ($showempty) $out.= ''."\n"; $num = $this->db->num_rows($resql); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index fdb8b89f0f1..0e6214560c4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2959,16 +2959,18 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois * @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param string $morehtml More html to show * @param string $morecss More css to the table + * @param int $limit Limit ofnumber of lines on each page * @return void */ -function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='') +function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=0) { global $conf,$langs; if ($picto == 'setup') $picto='title_setup.png'; if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif'; - - if (($num > $conf->liste_limit) || ($num == -1)) + if ($limit < 1) $limit = $conf->liste_limit; + + if (($num > $limit) || ($num == -1)) { $nextpage = 1; } @@ -2997,13 +2999,13 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so if ($sortorder) $options .= "&sortorder=".$sortorder; // Show navigation bar $pagelist = ''; - if ($page > 0 || $num > $conf->liste_limit) + if ($page > 0 || $num > $limit) { if ($totalnboflines) // If we know total nb of lines { $maxnbofpage=(empty($conf->dol_optimize_smallscreen) ? 6 : 3); // nb before and after selected page + ... + first or last - $nbpages=ceil($totalnboflines/$conf->liste_limit); + $nbpages=ceil($totalnboflines/$limit); $cpt=($page-$maxnbofpage); if ($cpt < 0) { $cpt=0; } diff --git a/htdocs/fichinter/admin/fichinter_extrafields.php b/htdocs/fichinter/admin/fichinter_extrafields.php index 955b66f0beb..b7b809d277d 100644 --- a/htdocs/fichinter/admin/fichinter_extrafields.php +++ b/htdocs/fichinter/admin/fichinter_extrafields.php @@ -89,8 +89,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -103,7 +103,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index df122ef1fff..bfdfea41fe4 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -251,6 +251,8 @@ class PaiementFourn extends Paiement */ function delete($notrigger=0) { + global $conf, $user, $langs; + $bank_line_id = $this->bank_line; $this->db->begin(); @@ -319,6 +321,19 @@ class PaiementFourn extends Paiement return -4; } } + + if (! $notrigger) + { + // Appel des triggers + $result=$this->call_trigger('PAYMENT_SUPPLIER_DELETE', $user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + // Fin appel triggers + } + $this->db->commit(); return 1; } diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 80d06fdb446..608c2af1b24 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -84,7 +84,7 @@ if ($action == 'create') $description = trim(GETPOST('description')); $userID = GETPOST('userID'); - // If no start date + // If no type if ($type <= 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); @@ -136,12 +136,6 @@ if ($action == 'create') $result = 0; - if ($type < 1) - { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Type")), null, 'errors'); - $error++; - } - if (! $error) { $cp->fk_user = $userid; @@ -769,7 +763,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create dol_fiche_head(); $out=''; - $typeleaves=$cp->getTypes(1,1); + $typeleaves=$cp->getTypes(1,-1); foreach($typeleaves as $key => $val) { $nb_type = $cp->getCPforUser($user->id, $val['rowid']); @@ -806,7 +800,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print ''; print ''.$langs->trans("Type").''; print ''; - $typeleaves=$cp->getTypes(1,1); + $typeleaves=$cp->getTypes(1,-1); $arraytypeleaves=array(); foreach($typeleaves as $key => $val) { @@ -1019,7 +1013,7 @@ else print ''; print ''.$langs->trans("Type").''; print ''; - $typeleaves=$cp->getTypes(1,1); + $typeleaves=$cp->getTypes(1,-1); print $typeleaves[$cp->fk_type]['label']; print ''; print ''; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 6bb253319e0..21c36574ea9 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -732,6 +732,16 @@ class Holiday extends CommonObject if ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5').' '.$langs->trans('CancelCP'); if ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5').' '.$langs->trans('RefuseCP'); } + if ($mode == 3) + { + $pictoapproved='statut6'; + if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; + if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0'); + if ($statut == 2) return img_picto($langs->trans('ToReviewCP'),'statut1'); + if ($statut == 3) return img_picto($langs->trans('ApprovedCP'),$pictoapproved); + if ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5'); + if ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5'); + } if ($mode == 5) { $pictoapproved='statut6'; @@ -1795,7 +1805,7 @@ class Holiday extends CommonObject * Return array with list of types * * @param int $active Status of type - * @param int $affect Filter on affect + * @param int $affect Filter on affect (a request will change sold or not) * @return array Return array with list of types */ function getTypes($active=-1, $affect=-1) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 1c82288973e..5c28894fdbf 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -39,6 +39,7 @@ $langs->load('holidays'); // Protection if external user if ($user->societe_id > 0) accessforbidden(); +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -47,7 +48,7 @@ $page = $page == -1 ? 0 : $page; if (! $sortfield) $sortfield="cp.rowid"; if (! $sortorder) $sortorder="DESC"; -$offset = $conf->liste_limit * $page ; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -102,6 +103,9 @@ $holiday = new Holiday($db); $holidaystatic=new Holiday($db); $fuser = new User($db); +$childids = $user->getAllChildIds(); +$childids[]=$user->id; + // Update sold $result = $holiday->updateBalance(); @@ -111,7 +115,7 @@ $filter=''; llxHeader(array(),$langs->trans('CPTitreMenu')); -$order = $db->order($sortfield,$sortorder).$db->plimit($conf->liste_limit + 1, $offset); +$order = $db->order($sortfield,$sortorder).$db->plimit($limit + 1, $offset); // WHERE if(!empty($search_ref)) @@ -184,10 +188,8 @@ if (!empty($sall)) $filter.= natural_search(array_keys($fieldstosearchall), $sall); } +if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',',$childids).')'; -/************************************* - * Fin des filtres de recherche -*************************************/ // Récupération de l'ID de l'utilisateur $user_id = $user->id; @@ -200,7 +202,7 @@ if ($id > 0) $user_id = $fuser->id; } // Récupération des congés payés de l'utilisateur ou de tous les users -if (empty($user->rights->holiday->write_all) || $id > 0) +if (empty($user->rights->holiday->read_all) || $id > 0) { $holiday_payes = $holiday->fetchByUser($user_id,$order,$filter); // Load array $holiday->holiday } @@ -220,7 +222,8 @@ if ($holiday_payes == '-1') // Show table of vacations -$var=true; $num = count($holiday->holiday); +$var=true; +$num = count($holiday->holiday); $form = new Form($db); $formother = new FormOther($db); @@ -242,7 +245,9 @@ if ($id > 0) } else { - print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, "", $num, 0, 'title_hrm.png'); + //print $num; + //print count($holiday->holiday); + print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, "", $num, count($holiday->holiday), 'title_hrm.png', 0, '', '', $limit); dol_fiche_head(''); } diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 66107385bd5..ed7eb22c21d 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -573,3 +573,5 @@ insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN doc_ref varchar(300) NOT NULL; +ALTER TABLE llx_holiday ADD COLUMN tms timestamp; +ALTER TABLE llx_holiday ADD COLUMN entity integer DEFAULT 1 NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index 3f61b893bd4..0af8b35b041 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -19,6 +19,7 @@ CREATE TABLE llx_holiday ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, +entity integer DEFAULT 1 NOT NULL, -- Multi company id fk_user integer NOT NULL, fk_user_create integer, fk_type integer NOT NULL, @@ -26,7 +27,7 @@ date_create DATETIME NOT NULL, description VARCHAR( 255 ) NOT NULL, date_debut DATE NOT NULL, date_fin DATE NOT NULL, -halfday integer DEFAULT 0, +halfday integer DEFAULT 0, -- 0=start morning and end afternoon, -1=start afternoon end afternoon, 1=start morning and end morning, 2=start afternoon and end morning statut integer NOT NULL DEFAULT '1', fk_validator integer NOT NULL, date_valid DATETIME DEFAULT NULL, @@ -37,6 +38,7 @@ date_cancel DATETIME DEFAULT NULL, fk_user_cancel integer DEFAULT NULL, detail_refuse varchar( 250 ) DEFAULT NULL, note_private text, -note_public text +note_public text, +tms timestamp ) ENGINE=innodb; diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 725336d8790..4b8c9507b92 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -82,6 +82,7 @@ UserName=Name Employee=Employee FirstDayOfHoliday=First day of vacation LastDayOfHoliday=Last day of vacation +BoxTitleLastLeaveRequests=Last %s modified leave requests HolidaysMonthlyUpdate=Monthly update ManualUpdate=Manual update HolidaysCancelation=Leave request cancelation diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 49d45dd154e..435dfe5f78b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -106,6 +106,7 @@ NotePrivate=Note (private) PrecisionUnitIsLimitedToXDecimals=Dolibarr was setup to limit precision of unit prices to %s decimals. DoTest=Test ToFilter=Filter +NoFilter=No filter WarningYouHaveAtLeastOneTaskLate=Warning, you have at least one element that has exceeded the tolerance delay. yes=yes Yes=Yes diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 890027c9d30..1c35968790c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -829,7 +829,7 @@ $bcnd=array(0=>'class="impair nodrag nodrop nohover"',1=>'class="pair nodrag nod // Define messages variables $mesg=''; $warning=''; $error=0; -// deprecated, see setEventMessage() and dol_htmloutput_events() +// deprecated, see setEventMessages() and dol_htmloutput_events() $mesgs=array(); $warnings=array(); $errors=array(); // Constants used to defined number of lines in textarea diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php index 3c7cc30b7a3..d0e42276880 100644 --- a/htdocs/product/admin/product_extrafields.php +++ b/htdocs/product/admin/product_extrafields.php @@ -101,8 +101,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -115,7 +115,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index db450a09f6e..303180c2cb7 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -92,7 +92,7 @@ $sql.= ' AND cf.entity = ' . $conf->entity; if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) { $sql .= ' AND cf.fk_statut < 3'; } elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) { - $sql .= ' AND cf.fk_statut < 6'; // We want alos status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo). + $sql .= ' AND cf.fk_statut < 6'; // We want also status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo). } else { $sql .= ' AND cf.fk_statut < 5'; } diff --git a/htdocs/projet/admin/project_extrafields.php b/htdocs/projet/admin/project_extrafields.php index 39786f5ad71..e3e070a3473 100644 --- a/htdocs/projet/admin/project_extrafields.php +++ b/htdocs/projet/admin/project_extrafields.php @@ -88,7 +88,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -102,7 +102,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/projet/admin/project_task_extrafields.php b/htdocs/projet/admin/project_task_extrafields.php index e9dc8be64e1..3d6e1d78fe8 100644 --- a/htdocs/projet/admin/project_task_extrafields.php +++ b/htdocs/projet/admin/project_task_extrafields.php @@ -87,7 +87,7 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel */ +/* Creation of an optional field */ /* */ /* ************************************************************************** */ @@ -101,7 +101,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php index 56bf58cf61d..37db7d02e4c 100644 --- a/htdocs/societe/admin/contact_extrafields.php +++ b/htdocs/societe/admin/contact_extrafields.php @@ -88,8 +88,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -102,7 +102,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php index a7589566175..ceb86d102bd 100644 --- a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php +++ b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php @@ -121,8 +121,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -135,7 +135,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/user/admin/group_extrafields.php b/htdocs/user/admin/group_extrafields.php index 2301f109282..99eab0e3a88 100644 --- a/htdocs/user/admin/group_extrafields.php +++ b/htdocs/user/admin/group_extrafields.php @@ -89,8 +89,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -103,7 +103,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Edition of an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/webservices/admin/index.php b/htdocs/webservices/admin/index.php index f75c60c6c45..5d21c97ce5f 100644 --- a/htdocs/webservices/admin/index.php +++ b/htdocs/webservices/admin/index.php @@ -46,12 +46,12 @@ if ($actionsave) if ($i >= 1) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"), 'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } }