diff --git a/.tx/config b/.tx/config index 84e8e9f842f..3759da60772 100644 --- a/.tx/config +++ b/.tx/config @@ -248,6 +248,12 @@ source_file = htdocs/langs/en_US/propal.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.salaries] +file_filter = htdocs/langs//salaries.lang +source_file = htdocs/langs/en_US/salaries.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.sendings] file_filter = htdocs/langs//sendings.lang source_file = htdocs/langs/en_US/sendings.lang diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index c52ee7a0546..beddadbd16e 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2012 Marcos García - * Copyright (C) 2011-2014 Alexandre Spangaro + * Copyright (C) 2011-2014 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index aa8d26c32f4..221f071ad69 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2011-2014 Alexandre Spangaro + * Copyright (C) 2011-2014 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ /** * \file htdocs/compta/charges/index.php * \ingroup compta - * \brief Page to list payments of social contributions, vat and salaries + * \brief Page to list payments of special expenses */ require '../../main.inc.php'; @@ -63,9 +63,9 @@ $socialcontrib=new ChargeSociales($db); $payment_sc_static=new PaymentSocialContribution($db); $sal_static = new PaymentSalary($db); -llxHeader('',$langs->trans("TaxAndDividendsArea")); +llxHeader('',$langs->trans("SpecialExpensesArea")); -$title=$langs->trans("TaxAndDividendsArea"); +$title=$langs->trans("SpecialExpensesArea"); if ($_GET["mode"] == 'sconly') $title=$langs->trans("SocialContributionsPayments"); $param=''; @@ -84,259 +84,267 @@ if (GETPOST("mode") != 'sconly') } // Payment Salary -if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') +if ($conf->salaries->enabled) { - $sal = new PaymentSalary($db); + if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') + { + $sal = new PaymentSalary($db); - print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); + print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); - $sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; - $sql.= " WHERE s.entity = ".$conf->entity; + $sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm"; + $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; + $sql.= " WHERE s.entity = ".$conf->entity; + if ($year > 0) + { + // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, + // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire + $sql.= " AND s.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; + } + if (preg_match('/^s/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + $total = 0 ; + print ''; + print ''; + print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="120"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); + print "\n"; + $var=1; + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total = $total + $obj->amount; + + $var=!$var; + print ""; + print ''."\n"; + + print "\n"; + + print '"; + + // Ref payment + $sal_static->id=$obj->rowid; + $sal_static->ref=$obj->rowid; + print '\n"; + + print '\n"; + print '"; + print "\n"; + + $i++; + } + print ''; + print '"; + print ''; + print ''; + print '"; + print ""; + + print "
'.dol_print_date($db->jdate($obj->dm),'day').'".$obj->label."'.price($obj->amount)."'.$sal_static->getNomUrl(1)."'.dol_print_date($db->jdate($obj->dm),'day')."'.price($obj->amount)."
'.$langs->trans("Total").''.price($total)."  '.price($total)."
"; + $db->free($result); + + print "
"; + } + else + { + dol_print_error($db); + } + } +} + + +if ($conf->tax->enabled) +{ + // Social contributions only + if (GETPOST("mode") != 'sconly') + { + print_fiche_titre($langs->trans("SocialContributionsPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); + } + + print ''; + print ''; + print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="120"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder); + print "\n"; + + $sql = "SELECT c.id, c.libelle as lib,"; + $sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,"; + $sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; + $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; + $sql.= " WHERE cs.fk_type = c.id"; + $sql.= " AND cs.entity = ".$conf->entity; if ($year > 0) { + $sql .= " AND ("; // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire - $sql.= " AND s.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; + $sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; + $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; + $sql .= ")"; } - if (preg_match('/^s/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); + if (! preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); + //$sql.= $db->plimit($limit+1,$offset); + //print $sql; - $result = $db->query($sql); - if ($result) + dol_syslog("compta/charges/index.php: select payment sql=".$sql); + $resql=$db->query($sql); + if ($resql) { - $num = $db->num_rows($result); - $i = 0; - $total = 0 ; - print '
'; - print ''; - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="120"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); - print "\n"; - $var=1; - while ($i < $num) - { - $obj = $db->fetch_object($result); + $num = $db->num_rows($resql); + $i = 0; + $total = 0; + $totalnb = 0; + $totalpaye = 0; + $var=true; - $total = $total + $obj->amount; - - $var=!$var; - print ""; - print ''."\n"; - - print "\n"; - - print '"; - - // Ref payment - $sal_static->id=$obj->rowid; - $sal_static->ref=$obj->rowid; - print '\n"; - - print '\n"; - print '"; - print "\n"; - - $i++; - } - print ''; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $var = !$var; + print ""; + // Date + $date=$obj->periode; + if (empty($date)) $date=$obj->date_ech; + print ''; + // Label + print ''; + // Type + print ''; + // Expected to pay + print ''; + // Ref payment + $payment_sc_static->id=$obj->pid; + $payment_sc_static->ref=$obj->pid; + print '\n"; + // Date payment + print ''; + // Paid + print ''; + print ''; + $total = $total + $obj->total; + $totalnb = $totalnb + $obj->nb; + $totalpaye = $totalpaye + $obj->totalpaye; + $i++; + } + print ''; print '"; print ''; print ''; - print '"; - print ""; - - print "
'.dol_print_date($db->jdate($obj->dm),'day').'".$obj->label."'.price($obj->amount)."'.$sal_static->getNomUrl(1)."'.dol_print_date($db->jdate($obj->dm),'day')."'.price($obj->amount)."
'.$langs->trans("Total").'
'.dol_print_date($date,'day').''; + $socialcontrib->id=$obj->rowid; + $socialcontrib->ref=$obj->libelle; + $socialcontrib->lib=$obj->libelle; + print $socialcontrib->getNomUrl(1,'20'); + print ''.$obj->lib.''.price($obj->total).''.$payment_sc_static->getNomUrl(1)."'.dol_print_date($db->jdate($obj->datep),'day').''.price($obj->totalpaye).'
'.$langs->trans("Total").''.price($total)."  '.price($total)."
"; - $db->free($result); - - print "
"; - } + print ''.price($totalpaye).""; + print ""; + } else { - dol_print_error($db); + dol_print_error($db); } + print ''; } -// Social contributions only -if (GETPOST("mode") != 'sconly') -{ - print_fiche_titre($langs->trans("SocialContributionsPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); -} - -print ''; -print ''; -print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="120"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder); -print "\n"; - -$sql = "SELECT c.id, c.libelle as lib,"; -$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,"; -$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye"; -$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; -$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; -$sql.= " WHERE cs.fk_type = c.id"; -$sql.= " AND cs.entity = ".$conf->entity; -if ($year > 0) -{ - $sql .= " AND ("; - // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, - // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire - $sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; - $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; - $sql .= ")"; -} -if (! preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); -//$sql.= $db->plimit($limit+1,$offset); -//print $sql; - -dol_syslog("compta/charges/index.php: select payment sql=".$sql); -$resql=$db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - $total = 0; - $totalnb = 0; - $totalpaye = 0; - $var=true; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var = !$var; - print ""; - // Date - $date=$obj->periode; - if (empty($date)) $date=$obj->date_ech; - print ''; - // Label - print ''; - // Type - print ''; - // Expected to pay - print ''; - // Ref payment - $payment_sc_static->id=$obj->pid; - $payment_sc_static->ref=$obj->pid; - print '\n"; - // Date payment - print ''; - // Paid - print ''; - print ''; - $total = $total + $obj->total; - $totalnb = $totalnb + $obj->nb; - $totalpaye = $totalpaye + $obj->totalpaye; - $i++; - } - print ''; - print '"; - print ''; - print ''; - print '"; - print ""; -} -else -{ - dol_print_error($db); -} -print '
'.dol_print_date($date,'day').''; - $socialcontrib->id=$obj->rowid; - $socialcontrib->ref=$obj->libelle; - $socialcontrib->lib=$obj->libelle; - print $socialcontrib->getNomUrl(1,'20'); - print ''.$obj->lib.''.price($obj->total).''.$payment_sc_static->getNomUrl(1)."'.dol_print_date($db->jdate($obj->datep),'day').''.price($obj->totalpaye).'
'.$langs->trans("Total").''.price($total)."  '.price($totalpaye)."
'; - - // VAT - -if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') +if ($conf->tax->enabled) { - print "
"; - - $tva = new Tva($db); - - print_fiche_titre($langs->trans("VATPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); - - $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm"; - $sql.= " FROM ".MAIN_DB_PREFIX."tva as pv"; - $sql.= " WHERE pv.entity = ".$conf->entity; - if ($year > 0) + if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') { - // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, - // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire - $sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; - } - if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); + print "
"; - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $i = 0; - $total = 0 ; - print ''; - print ''; - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); - print "\n"; - $var=1; - while ($i < $num) - { - $obj = $db->fetch_object($result); + $tva = new Tva($db); - $total = $total + $obj->amount; + print_fiche_titre($langs->trans("VATPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); - $var=!$var; - print ""; - print ''."\n"; + $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm"; + $sql.= " FROM ".MAIN_DB_PREFIX."tva as pv"; + $sql.= " WHERE pv.entity = ".$conf->entity; + if ($year > 0) + { + // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, + // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire + $sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; + } + if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); - print "\n"; + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + $total = 0 ; + print '
'.dol_print_date($db->jdate($obj->dm),'day').'".$obj->label."
'; + print ''; + print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print "\n"; + $var=1; + while ($i < $num) + { + $obj = $db->fetch_object($result); - print '"; + $total = $total + $obj->amount; - // Ref payment - $tva_static->id=$obj->rowid; - $tva_static->ref=$obj->rowid; - print '\n"; + $var=!$var; + print ""; + print ''."\n"; - print '\n"; - print '"; - print "\n"; + print "\n"; - $i++; - } - print ''; - print '"; - print ''; - print ''; - print '"; - print ""; + print '"; - print "
'.price($obj->amount)."'.$tva_static->getNomUrl(1)."
'.dol_print_date($db->jdate($obj->dm),'day').''.dol_print_date($db->jdate($obj->dm),'day')."'.price($obj->amount)."
".$obj->label."
'.$langs->trans("Total").''.price($total)."  '.price($total)."
'.price($obj->amount)."
"; - $db->free($result); - } - else - { - dol_print_error($db); + // Ref payment + $tva_static->id=$obj->rowid; + $tva_static->ref=$obj->rowid; + print ''.$tva_static->getNomUrl(1)."\n"; + + print ''.dol_print_date($db->jdate($obj->dm),'day')."\n"; + print ''.price($obj->amount).""; + print "\n"; + + $i++; + } + print ''.$langs->trans("Total").''; + print ''.price($total).""; + print ' '; + print ' '; + print ''.price($total).""; + print ""; + + print ""; + $db->free($result); + } + else + { + dol_print_error($db); + } } } -$db->close(); - llxFooter(); + +$db->close(); ?> diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index bcb3ab9fbd7..1bbe32bc7cc 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -78,36 +78,6 @@ if ($action == 'validate' && $user->rights->deplacement->creer) } } -/* -else if ($action == 'unblock' && $user->rights->deplacement->unvalidate) -{ - $object->fetch($id); - if ($object->fk_statut == '1') // Not blocked... - { - $mesg='
'.$langs->trans("Error").'
'; - $action=''; - $error++; - } - else - { - $result = $object->fetch($id); - - $object->fk_statut = '1'; - - $result = $object->update($user); - - if ($result > 0) - { - header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); - exit; - } - else - { - $mesg=$object->error; - } - } -}*/ - else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) { $result=$object->delete($id); @@ -295,7 +265,7 @@ if ($action == 'create') print ''.$langs->trans('NotePublic').''; print ''; - $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100); + $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100); print $doleditor->Create(1); print ''; @@ -307,7 +277,7 @@ if ($action == 'create') print ''.$langs->trans('NotePrivate').''; print ''; - $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100); + $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100); print $doleditor->Create(1); print ''; @@ -391,7 +361,7 @@ else if ($id) print ''.$langs->trans("NotePublic").''; print ''; - $doleditor = new DolEditor('note_public', $object->note_public, 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100'); + $doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100'); print $doleditor->Create(1); print ""; @@ -402,7 +372,7 @@ else if ($id) print ''.$langs->trans("NotePrivate").''; print ''; - $doleditor = new DolEditor('note_private', $object->note_private, 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100'); + $doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100'); print $doleditor->Create(1); print ""; diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index 3ca0d70e156..b61ea9fd4d5 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -121,6 +121,7 @@ print ''; print ''; + print '
'; diff --git a/htdocs/compta/hrm.php b/htdocs/compta/hrm.php new file mode 100644 index 00000000000..95b133e8446 --- /dev/null +++ b/htdocs/compta/hrm.php @@ -0,0 +1,181 @@ + + * Copyright (C) 2013-2014 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/compta/hrm.php + * \ingroup hrm + * \brief Home page for HRM area. + */ + +require('../main.inc.php'); +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; + +$langs->load('users'); +$langs->load('holidays'); +$langs->load('tripss'); + +// Protection if external user +if ($user->societe_id > 0) accessforbidden(); + + + +/* + * Actions + */ + +// None + + + +/* + * View + */ + +$holiday = new Holiday($db); +$holidaystatic=new Holiday($db); + + +llxHeader(array(),$langs->trans('HRMArea')); + + + +print '
'; + + +if (! empty($conf->holiday->enabled)) +{ + $user_id = $user->id; + + $nbaquis=$holiday->getCPforUser($user_id); + $nbdeduced=$holiday->getConfCP('nbHolidayDeducted'); + $nb_holiday = $nbaquis / $nbdeduced; + + print ''; + print ''; + print ""; + print ''; + print ''; + print '
'.$langs->trans("Holidays").'
'; + print $langs->trans('SoldeCPUser',round($nb_holiday,2)).($nbdeduced != 1 ? ' ('.$nbaquis.' / '.$nbdeduced.')' : ''); + print '

'; +} + + +/* + * Search expenses + */ +if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) +{ + $langs->load("trips"); + print '
'; + print ''; + print ''; + print ''; + print ""; + print "'; + print ''; + //print "'; + print ''; + print "
'.$langs->trans("SearchATripAndExpense").'
".$langs->trans("Ref").':
".$langs->trans("Other").':

"; +} + + +print '
'; + + +$max=10; + +$langs->load("boxes"); + +$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"; +$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u"; +if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql.= " WHERE u.rowid = d.fk_user"; +$sql.= " AND d.entity = ".$conf->entity; +if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) $sql.= " AND d.fk_soc = ".$socid; +$sql.= $db->order("d.tms","DESC"); +$sql.= $db->plimit($max, 0); + +$result = $db->query($sql); +if ($result) +{ + $var=false; + $num = $db->num_rows($result); + + $i = 0; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($num) + { + $total_ttc = $totalam = $total = 0; + + $deplacementstatic=new Deplacement($db); + $userstatic=new User($db); + while ($i < $num && $i < $max) + { + $obj = $db->fetch_object($result); + $deplacementstatic->ref=$obj->rowid; + $deplacementstatic->id=$obj->rowid; + $userstatic->id=$obj->uid; + $userstatic->lastname=$obj->lastname; + $userstatic->firstname=$obj->firstname; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $var=!$var; + $i++; + } + + } + else + { + print ''; + } + print '
'.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).''.$langs->trans("FeesKilometersOrAmout").''.$langs->trans("DateModificationShort").' 
'.$deplacementstatic->getNomUrl(1).''.$userstatic->getNomUrl(1).''.$obj->km.''.dol_print_date($db->jdate($obj->dm),'day').''.$deplacementstatic->LibStatut($obj->fk_statut,3).'
'.$langs->trans("None").'

'; +} +else dol_print_error($db); + + +print '
'; + + + +llxFooter(); + +$db->close(); +?> diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 0580ac766d5..9a7839fd1c3 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -139,24 +139,6 @@ if (! empty($conf->don->enabled) && $user->rights->don->lire) print "
"; } -/* - * Search expenses - */ -if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) -{ - $langs->load("trips"); - print '
'; - print ''; - print ''; - print ''; - print ""; - print "'; - print ''; - //print "'; - print ''; - print "
'.$langs->trans("SearchATripAndExpense").'
".$langs->trans("Ref").':
".$langs->trans("Other").':

"; -} - /** * Draft customers invoices */ diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 49e2d1eb65b..ebdd5fa1655 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -17,8 +17,8 @@ /** * \file htdocs/compta/salaries/class/paymentsalary.class.php - * \ingroup tax - * \brief Class for tax module salary payment + * \ingroup salaries + * \brief Class for salaries module payment */ // Put here all includes required by your class file @@ -76,7 +76,7 @@ class PaymentSalary extends CommonObject global $conf, $langs; $error=0; - + // Clean parameters $this->fk_user=trim($this->fk_user); $this->amount=trim($this->amount); @@ -85,10 +85,10 @@ class PaymentSalary extends CommonObject $this->fk_bank=trim($this->fk_bank); $this->fk_user_creat=trim($this->fk_user_creat); $this->fk_user_modif=trim($this->fk_user_modif); - + // Check parameters // Put here code to add control on parameters values - + // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary("; $sql.= "tms,"; @@ -103,9 +103,9 @@ class PaymentSalary extends CommonObject $sql.= "fk_bank,"; $sql.= "fk_user_creat,"; $sql.= "fk_user_modif"; - + $sql.= ") VALUES ("; - + $sql.= " '".$this->db->idate($this->tms).","; $sql.= " '".$this->fk_user."',"; $sql.= " '".$this->db->idate($this->datep)."',"; @@ -118,7 +118,7 @@ class PaymentSalary extends CommonObject $sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->fk_bank."'").","; $sql.= " '".$this->fk_user_creat."',"; $sql.= " '".$this->fk_user_modif."'"; - + $sql.= ")"; dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); @@ -146,7 +146,7 @@ class PaymentSalary extends CommonObject /** * Update database - * + * * @param User $user User that modify * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK @@ -156,7 +156,7 @@ class PaymentSalary extends CommonObject global $conf, $langs; $error=0; - + // Clean parameters $this->fk_user=trim($this->fk_user); $this->amount=trim($this->amount); @@ -165,7 +165,7 @@ class PaymentSalary extends CommonObject $this->fk_bank=trim($this->fk_bank); $this->fk_user_creat=trim($this->fk_user_creat); $this->fk_user_modif=trim($this->fk_user_modif); - + // Check parameters if (empty($this->fk_user) || $this->fk_user < 0) { @@ -216,7 +216,7 @@ class PaymentSalary extends CommonObject /** * Load object in memory from database - * + * * @param int $id id object * @param User $user User that load * @return int <0 if KO, >0 if OK @@ -226,7 +226,7 @@ class PaymentSalary extends CommonObject global $langs; $sql = "SELECT"; $sql.= " s.rowid,"; - + $sql.= " s.tms,"; $sql.= " s.fk_user,"; $sql.= " s.datep,"; @@ -288,7 +288,7 @@ class PaymentSalary extends CommonObject /** * Delete object in database - * + * * @param User $user User that delete * @return int <0 if KO, >0 if OK */ @@ -360,7 +360,7 @@ class PaymentSalary extends CommonObject // Clean parameters $this->amount=price2num(trim($this->amount)); - + // Check parameters if (! $this->label) { @@ -369,7 +369,7 @@ class PaymentSalary extends CommonObject } if ($this->fk_user < 0 || $this->fk_user == '') { - $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Person")); + $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Employee")); return -4; } if ($this->amount < 0 || $this->amount == '') @@ -439,19 +439,19 @@ class PaymentSalary extends CommonObject $acc = new Account($this->db); $result=$acc->fetch($this->accountid); if ($result <= 0) dol_print_error($this->db); - + // Insert payment into llx_bank // Add link 'payment_salary' in bank_url between payment and bank transaction $bank_line_id = $acc->addline( $this->datep, $this->paymenttype, $this->label, - -abs($this->amount), + -abs($this->amount), '', '', $user ); - + // Mise a jour fk_bank dans llx_paiement. // On connait ainsi le paiement qui a genere l'ecriture bancaire if ($bank_line_id > 0) @@ -463,26 +463,26 @@ class PaymentSalary extends CommonObject $this->error=$acc->error; $ok=0; } - + // Add link 'payment_salary' in bank_url between payment and bank transaction $url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id='; - + $result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary"); if ($result <= 0) { $this->error=$acc->error; $ok=0; } - + // Add link 'user' in bank_url between operation and bank transaction $linkaddedforthirdparty=array(); foreach ($this->amounts as $key => $value) { $sal = new PaymentSalary($this->db); - + $sal->fetch($key); $sal->fetch_user($this->fk_user); - + if (! in_array($sal->user->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty { $result=$acc->add_url_line( @@ -492,14 +492,14 @@ class PaymentSalary extends CommonObject $sal->user->lastname, 'user' ); - + if ($result <= 0) dol_print_error($this->db); $linkaddedforthirdparty[$sal->user->id]=$sal->user->id; // Mark as done for this thirdparty } - + } } - + if ($ok) { $this->db->commit(); diff --git a/htdocs/compta/salaries/fiche.php b/htdocs/compta/salaries/fiche.php index 636dc8f5002..ca49efc068b 100644 --- a/htdocs/compta/salaries/fiche.php +++ b/htdocs/compta/salaries/fiche.php @@ -18,7 +18,7 @@ /** * \file htdocs/compta/salaries/fiche.php * \ingroup tax - * \brief Page of salaries payments + * \brief Page of salaries payments */ require '../../main.inc.php'; @@ -29,6 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("compta"); $langs->load("banks"); $langs->load("bills"); +$langs->load("users"); +$langs->load("salaries"); $id=GETPOST("id",'int'); $action=GETPOST('action'); @@ -164,15 +166,15 @@ if ($action == 'create') $pastmonth = 12; $pastmonthyear--; } - + $datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear); $dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear); - + if (empty($datesp) || empty($dateep)) // We define date_start and date_end { $datesp=dol_get_first_day($pastmonthyear,$pastmonth,false); $dateep=dol_get_last_day($pastmonthyear,$pastmonth,false); } - + print "
\n"; print ''; print ''; @@ -189,15 +191,16 @@ if ($action == 'create') print ''.$langs->trans("DateValue").''; print $form->select_date($datev,"datev",'','','','add'); print ''; - + + // Employee print ""; - print ''.$langs->trans("Person").''; + print ''.$langs->trans("Employee").''; print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1); print ''; // Label print ''.$langs->trans("Label").'trans("SalaryPayment")).'">'; - + print ""; print ''.$langs->trans("DateStartPeriod").''; print $form->select_date($datesp,"datesp",'','','','add'); @@ -209,31 +212,31 @@ if ($action == 'create') // Amount print ''.$langs->trans("Amount").''; - + // Bank if (! empty($conf->banque->enabled)) { print ''.$langs->trans("Account").''; $form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant print ''; - + print ''.$langs->trans("PaymentMode").''; $form->select_types_paiements($_POST["paiementtype"], "paiementtype"); print "\n"; print ""; } - + // Other attributes $parameters=array('colspan' => ' colspan="1"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - + print ''; - + print "
"; - + print '
  '; print '
'; - + print '
'; } @@ -261,7 +264,7 @@ if ($id) print ''.$langs->trans("Ref").''; print $salpayment->ref; print ''; - + // Person print ''.$langs->trans("Person").''; $usersal=new User($db); @@ -280,7 +283,7 @@ if ($id) print ''.$langs->trans("DateEndPeriod").''; print dol_print_date($salpayment->dateep,'day'); print ''; - + print ""; print ''.$langs->trans("DatePayment").''; print dol_print_date($salpayment->datep,'day'); diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index a7d1b84987d..7de22d79196 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -25,6 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; $langs->load("compta"); +$langs->load("salaries"); // Security check $socid = isset($_GET["socid"])?$_GET["socid"]:''; @@ -41,7 +42,7 @@ llxHeader(); $salstatic = new PaymentSalary($db); $userstatic = new User($db); - + print_fiche_titre($langs->trans("SalariesPayments")); diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 468e9e9ac48..96e3a25e516 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -18,7 +18,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run', '', 2, 90, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('boutique', '! empty($conf->boutique->enabled)', 11__+MAX_llx_menu__, __HANDLER__, 'top', 'shop', '', 0, '/boutique/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 100, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('holiday', '$conf->holiday->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/holiday/index.php?mainmenu=holiday&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->holiday->write', '', 0, 80, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm', '$conf->holiday->enabled || $conf->deplacement->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/compta/hrm.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->holiday->write || $user->rights->deplacement->lire', '', 0, 80, __ENTITY__); -- Home - Setup insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 0, __ENTITY__); @@ -174,13 +174,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/liste.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/stats.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__); --- Trips and expenses -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2100__+MAX_llx_menu__, 'accountancy', 'tripsandexpenses', 6__+MAX_llx_menu__, '/compta/deplacement/index.php?leftmenu=tripsandexpenses', 'TripsAndExpenses', 0, 'trips', '$user->rights->deplacement->lire', '', 0, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled && $leftmenu=="tripsandexpenses"', __HANDLER__, 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->rights->deplacement->creer', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled && $leftmenu=="tripsandexpenses"', __HANDLER__, 'left', 2102__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/list.php?leftmenu=tripsandexpenses', 'List', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled && $leftmenu=="tripsandexpenses"', __HANDLER__, 'left', 2103__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses', 'Statistics', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuTaxAndDividends', 0, 'compta', '$user->rights->tax->charges->lire', '', 0, 6, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2201__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); +-- Special expenses +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '1', '', 0, 6, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2201__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2202__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/salaries/fiche.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2203__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'accountancy', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); @@ -280,10 +276,15 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Members - Category member insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/fiche.php?action=create&type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); --- HRM +-- HRM - Holiday insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/index.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/fiche.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/month_report.php?&action=request', 'MenuReportMonth', 1, 'holiday', '$user->rights->holiday->month_report', '', 0, 4, __ENTITY__); +-- HRM - Trips and expenses +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2100__+MAX_llx_menu__, 'accountancy', 'tripsandexpenses', 15__+MAX_llx_menu__, '/compta/deplacement/index.php?leftmenu=tripsandexpenses', 'TripsAndExpenses', 0, 'trips', '$user->rights->deplacement->lire', '', 0, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->rights->deplacement->creer', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2102__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/list.php?leftmenu=tripsandexpenses', 'List', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2103__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses', 'Statistics', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 90e1ec5ceec..3d6b9d323ac 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2014 Laurent Destailleur * Copyright (C) 2010 Regis Houssin * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2013 Cédric Salvador @@ -134,9 +134,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } // Financial - $tmpentry=array('enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->don->enabled) || ! empty($conf->tax->enabled)), - 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire)), - 'module'=>'comptabilite|accounting|facture|deplacement|don|tax'); + $tmpentry=array('enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->don->enabled) || ! empty($conf->tax->enabled)), + 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire)), + 'module'=>'comptabilite|accounting|facture|don|tax'); $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); if ($showmode) { @@ -195,9 +195,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } // HRM - $tmpentry=array('enabled'=>(! empty($conf->holiday->enabled)), - 'perms'=>(! empty($user->rights->holiday->write)), - 'module'=>'holiday'); + $tmpentry=array('enabled'=>(! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled)), + 'perms'=>(! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire)), + 'module'=>'holiday|deplacement'); $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); if ($showmode) { @@ -209,9 +209,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) $idsel='hrm'; if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); - if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/holiday/index.php?mainmenu=hrm&leftmenu=', $id, $idsel, $classname, $atarget); + if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/compta/hrm.php?mainmenu=hrm&leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_end_menu_entry($showmode); - $menu->add('/holiday/index.php?mainmenu=holiday&leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", ''); + $menu->add('/compta/hrm.php?mainmenu=hrm&leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", ''); } @@ -790,27 +790,23 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu //if ($leftmenu=="donations") $newmenu->add("/compta/dons/stats.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); } - // Trips and expenses - if (! empty($conf->deplacement->enabled)) - { - $langs->load("trips"); - $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses'); - if (empty($leftmenu) || $leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("New"), 1, $user->rights->deplacement->creer); - if (empty($leftmenu) || $leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("List"), 1, $user->rights->deplacement->lire); - if (empty($leftmenu) || $leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire); - } - // Taxes and social contributions - if (! empty($conf->tax->enabled)) + if (! empty($conf->tax->enabled) || ! empty($conf->salaries->enabled)) { - $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy",$langs->trans("MenuTaxAndDividends"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax'); - // Salaries - if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy",$langs->trans("Salaries"),1,$user->rights->tax->charges->lire, '', $mainmenu, 'tax_salary'); - if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/fiche.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); - if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); global $mysoc; - // Social contributions - if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire); + + $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy",$langs->trans("MenuSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax'); + + // Salaries + if (! empty($conf->salaries->enabled)) + { + $langs->load("salaries"); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy",$langs->trans("Salaries"),1,$user->rights->salaries->read, '', $mainmenu, 'tax_salary'); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/fiche.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->create); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->read); + } + // Social contributions + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire); if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer); if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly",$langs->trans("Payments"), 2, $user->rights->tax->charges->lire); // VAT @@ -1089,17 +1085,26 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu */ if ($mainmenu == 'hrm') { + // Holiday module if (! empty($conf->holiday->enabled)) { $langs->load("holiday"); - // HRM: Holiday module $newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->write, '', $mainmenu, 'hrm'); $newmenu->add("/holiday/fiche.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write); $newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday); $newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log); $newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->month_report); + } + // Trips and expenses + if (! empty($conf->deplacement->enabled)) + { + $langs->load("trips"); + $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses'); + $newmenu->add("/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("New"), 1, $user->rights->deplacement->creer); + $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("List"), 1, $user->rights->deplacement->lire); + $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=accountancy", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire); } } diff --git a/htdocs/core/modules/modDeplacement.class.php b/htdocs/core/modules/modDeplacement.class.php index 199e2472437..a1e9a655c6e 100644 --- a/htdocs/core/modules/modDeplacement.class.php +++ b/htdocs/core/modules/modDeplacement.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -89,24 +89,12 @@ class modDeplacement extends DolibarrModules $this->rights[2][3] = 0; $this->rights[2][4] = 'creer'; - $this->rights[3][0] = 173; + $this->rights[3][0] = 173; $this->rights[3][1] = 'Supprimer les deplacements'; $this->rights[3][2] = 'd'; $this->rights[3][3] = 0; $this->rights[3][4] = 'supprimer'; -/* - $this->rights[4][0] = 174; - $this->rights[4][1] = 'Bloquer les deplacements'; - $this->rights[4][2] = 'a'; - $this->rights[4][3] = 0; - $this->rights[4][4] = 'valider'; - $this->rights[5][0] = 175; - $this->rights[5][1] = 'Debloquer les deplacements'; - $this->rights[5][2] = 'a'; - $this->rights[5][3] = 0; - $this->rights[5][4] = 'unvalidate'; -*/ $this->rights[6][0] = 178; $this->rights[6][1] = 'Exporter les deplacements'; $this->rights[6][2] = 'd'; diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php new file mode 100644 index 00000000000..ede678137e3 --- /dev/null +++ b/htdocs/core/modules/modSalaries.class.php @@ -0,0 +1,177 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2012 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \defgroup tax Module salaries + * \brief Module to include salaries management + * \file htdocs/core/modules/modSalaries.class.php + * \ingroup salaries + * \brief File to activate module salaries + */ +include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; + + +/** + * Class to manage salaries module + */ +class modSalaries extends DolibarrModules +{ + + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + global $conf; + + $this->db = $db; + $this->numero = 510; + + $this->family = "hr"; + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) + $this->name = preg_replace('/^mod/i','',get_class($this)); + // Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) + $this->description = "Employees salaries management"; + + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; + + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + $this->special = 0; + $this->picto='bill'; + + // Data directories to create when module is enabled + $this->dirs = array("/salaries/temp"); + + // Config pages + $this->config_page_url = array(); + + // Dependances + $this->depends = array(); + $this->requiredby = array(); + $this->conflictwith = array(); + $this->langfiles = array("salaries"); + + // Constantes + $this->const = array(); + + // Boites + $this->boxes = array(); + + // Permissions + $this->rights = array(); + $this->rights_class = 'salaries'; + $r=0; + + $r++; + $this->rights[$r][0] = 510; + $this->rights[$r][1] = 'Read salaries'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'read'; + $this->rights[$r][5] = ''; + + $r++; + $this->rights[$r][0] = 511; + $this->rights[$r][1] = 'Create/modify salaries'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'create'; + $this->rights[$r][5] = ''; + + $r++; + $this->rights[$r][0] = 512; + $this->rights[$r][1] = 'Delete salaries'; + $this->rights[$r][2] = 'd'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'delete'; + $this->rights[$r][5] = ''; + + $r++; + $this->rights[$r][0] = 515; + $this->rights[$r][1] = 'Export salaries'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'export'; + $this->rights[$r][5] = ''; + + + // Exports + //-------- + $r=0; +/* + $r++; + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='Payment of salaries'; + $this->export_permission[$r]=array(array("tax","charges","export")); + $this->export_fields_array[$r]=array('cc.libelle'=>"Type",'c.rowid'=>"IdSocialContribution",'c.libelle'=>"Label",'c.date_ech'=>'DateDue','c.periode'=>'Period','c.amount'=>"AmountExpected","c.paye"=>"Status",'p.rowid'=>'PaymentId','p.datep'=>'DatePayment','p.amount'=>'AmountPayment','p.num_paiement'=>'Numero'); + $this->export_TypeFields_array[$r]=array('cc.libelle'=>"List:c_chargesociales:libelle:id",'c.libelle'=>"Text",'c.date_ech'=>'Date','c.periode'=>'Period','c.amount'=>"Number","c.paye"=>"Boolean",'p.datep'=>'Date','p.amount'=>'Number','p.num_paiement'=>'Number'); + $this->export_entities_array[$r]=array('cc.libelle'=>"tax_type",'c.rowid'=>"tax",'c.libelle'=>'tax','c.date_ech'=>'tax','c.periode'=>'tax','c.amount'=>"tax","c.paye"=>"tax",'p.rowid'=>'payment','p.datep'=>'payment','p.amount'=>'payment','p.num_paiement'=>'payment'); + + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'c_chargesociales as cc, '.MAIN_DB_PREFIX.'chargesociales as c'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementcharge as p ON p.fk_charge = c.rowid'; + $this->export_sql_end[$r] .=' WHERE c.fk_type = cc.id'; + $this->export_sql_end[$r] .=' AND c.entity = '.$conf->entity; + */ + } + + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + function init($options='') + { + global $conf; + + // Nettoyage avant activation + $this->remove($options); + + $sql = array(); + + return $this->_init($sql,$options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + function remove($options='') + { + $sql = array(); + + return $this->_remove($sql,$options); + } + +} +?> diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php index d42b9622ee5..71619a677af 100644 --- a/htdocs/holiday/index.php +++ b/htdocs/holiday/index.php @@ -233,7 +233,7 @@ else { print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, "", $num); - print '
'; + dol_fiche_head(''); } @@ -248,7 +248,7 @@ if ($id > 0) print '
'; } else { - print '
'; + dol_fiche_end(); } print '
'."\n"; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 872c3f4db69..e06f937d74a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -465,8 +465,10 @@ Module400Name=Projects Module400Desc=Project management inside other modules Module410Name=Webcalendar Module410Desc=Webcalendar integration -Module500Name=Taxes, social contributions and dividends -Module500Desc=Taxes and social contribution management +Module500Name=Special expenses (tax, social contributions, dividends) +Module500Desc=Management of special expenses like taxes, social contribution, dividends and salaries +Module510Name=Salaries +Module510Desc=Management of empoyees salaries and payments Module600Name=Notifications Module600Desc=Send notifications by email on some Dolibarr business events to third party contacts Module700Name=Donations diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 6a4199ef326..b182952940e 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -288,7 +288,7 @@ InvoiceNotChecked=No invoice selected CloneInvoice=Clone invoice ConfirmCloneInvoice=Are you sure you want to clone this invoice %s ? DisabledBecauseReplacedInvoice=Action disabled because invoice has been replaced -DescTaxAndDividendsArea=This area presents a summary of all payments made for tax or social contributions. Only records with payment during the fixed year are included here. +DescTaxAndDividendsArea=This area presents a summary of all payments made for special expenses. Only records with payment during the fixed year are included here. NbOfPayments=Nb of payments SplitDiscount=Split discount in two ConfirmSplitDiscount=Are you sure you want to split this discount of %s %s into 2 lower discounts ? diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 03b3f6cbc39..5f83d92f802 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -48,9 +48,11 @@ LT2SupplierES=IRPF purchases VATCollected=VAT collected ToPay=To pay ToGet=To get back +SpecialExpensesArea=Area for all special paiements TaxAndDividendsArea=Tax, social contributions and dividends area SocialContribution=Social contribution SocialContributions=Social contributions +MenuSpecialExpenses=Special expenses MenuTaxAndDividends=Taxes and dividends MenuSalaries=Salaries MenuSocialContributions=Social contributions @@ -74,17 +76,13 @@ DatePayment=Payment date DateStartPeriod=Date start period DateEndPeriod=Date end period NewVATPayment=New VAT payment -NewSalaryPayment=New salary payment newLT2PaymentES=New IRPF payment LT2PaymentES=IRPF Payment LT2PaymentsES=IRPF Payments VATPayment=VAT Payment VATPayments=VAT Payments -SalaryPayment=Salary payment -SalariesPayments=Salaries payments SocialContributionsPayments=Social contributions payments ShowVatPayment=Show VAT payment -ShowSalaryPayment=Show salary payment TotalToPay=Total to pay TotalVATReceived=Total VAT received CustomerAccountancyCode=Customer accountancy code diff --git a/htdocs/langs/en_US/salaries.lang b/htdocs/langs/en_US/salaries.lang new file mode 100644 index 00000000000..edca71a1829 --- /dev/null +++ b/htdocs/langs/en_US/salaries.lang @@ -0,0 +1,8 @@ +# Dolibarr language file - Source file is en_US - users +Salary=Salary +Salaries=Salaries +Employee=Employee +NewSalaryPayment=New salary payment +SalaryPayment=Salary payment +SalariesPayments=Salaries payments +ShowSalaryPayment=Show salary payment diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index dbc1d2520c8..ae8e0f8cb27 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -74,17 +74,13 @@ DatePayment=Date de règlement DateStartPeriod=Date de début période DateEndPeriod=Date de fin période NewVATPayment=Nouveau règlement de TVA -NewSalaryPayment=Nouveau règlement de salaire newLT2PaymentES=Nouveau règlement de IRPF LT2PaymentES=Règlement IRPF LT2PaymentsES=Règlements IRPF VATPayment=Règlement TVA VATPayments=Règlements TVA -SalaryPayment=Règlement salaire -SalariesPayments=Règlements des salaires SocialContributionsPayments=Règlements charges sociales ShowVatPayment=Afficher paiement TVA -ShowSalaryPayment=Afficher paiement salaire TotalToPay=Total à payer TotalVATReceived=Total TVA perçue CustomerAccountancyCode=Compte comptable client