Skip to content

Commit

Permalink
Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 29, 2014
2 parents a518a72 + 2c46c20 commit 47fc72a
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 9 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -8,6 +8,7 @@ For users:
- Fix: sql errors on updat fichinter
- Fix: debian script syntax error
- Fix: error "menu param is not inside list" into pos module.
- Fix: Salary payments are not reflected on the reporting sheets

***** ChangeLog for 3.6 compared to 3.5.* *****
For users:
Expand Down
64 changes: 64 additions & 0 deletions htdocs/compta/resultat/clientfourn.php
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* 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
Expand Down Expand Up @@ -538,6 +539,69 @@
print '</tr>';
}

/*
* Salaries
*/

print '<tr><td colspan="4">'.$langs->trans("Salaries").'</td></tr>';
$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount, u.firstname, u.lastname, p.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
$sql.= " WHERE p.entity = ".$conf->entity;
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";

$sql.= " GROUP BY u.rowid";
$sql.= " ORDER BY u.firstname";

dol_syslog("get payment salaries sql=".$sql);
$result=$db->query($sql);
$subtotal_ht = 0;
$subtotal_ttc = 0;
if ($result)
{
$num = $db->num_rows($result);
$var=true;
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($result);

$total_ht -= $obj->amount;
$total_ttc -= $obj->amount;
$subtotal_ht += $obj->amount;
$subtotal_ttc += $obj->amount;

$var = !$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>";

print "<td>".$langs->trans("Salaries")." <a href=\"".DOL_URL_ROOT."/compta/salaries/index.php?filtre=s.fk_user=".$obj->fk_user."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";

if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price(-$obj->amount).'</td>';
print '<td align="right">'.price(-$obj->amount).'</td>';
print '</tr>';
$i++;
}
}
else
{
$var = !$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print '<td colspan="3">'.$langs->trans("None").'</td>';
print '</tr>';
}
}
else
{
dol_print_error($db);
}
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
print '</tr>';

/*
* VAT
Expand Down
39 changes: 39 additions & 0 deletions htdocs/compta/resultat/index.php
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* 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
Expand Down Expand Up @@ -469,6 +470,44 @@
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks

/*
* Salaries
*/
$subtotal_ht = 0;
$subtotal_ttc = 0;
$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " GROUP BY p.label, dm";

dol_syslog("get social salaries payments sql=".$sql);
$result=$db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$var=false;
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($result);

if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
$decaiss[$obj->dm] += $obj->amount;

if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
$decaiss_ttc[$obj->dm] += $obj->amount;

$i++;
}
}
}
else
{
dol_print_error($db);
}

/*
* Show result array
*/
Expand Down
18 changes: 9 additions & 9 deletions htdocs/core/class/html.formfile.class.php
@@ -1,10 +1,10 @@
<?php
/* Copyright (c) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (c) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (c) 2013 Charles-Fr BENKE <charles.fr@benke.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (c) 2014 Marcos García <marcosgdf@gmail.com>
/* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Charles-Fr BENKE <charles.fr@benke.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* 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
Expand Down Expand Up @@ -270,7 +270,7 @@ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed
if (! empty($iconPDF)) {
return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir);
}
$printer = ($user->rights->printipp->read && $conf->printipp->enabled)?true:false;
$printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false;
$hookmanager->initHooks(array('formfile'));
$forname='builddoc';
$out='';
Expand Down Expand Up @@ -514,11 +514,11 @@ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed
$out.= $genbutton;
$out.= '</th>';

if($hookmanager->hooks['formfile'])
if (!empty($hookmanager->hooks['formfile']))
{
foreach($hookmanager->hooks['formfile'] as $module)
{
if(method_exists($module, 'formBuilddocLineOptions')) $out .= '<th></th>';
if (method_exists($module, 'formBuilddocLineOptions')) $out .= '<th></th>';
}
}
$out.= '</tr>';
Expand Down

0 comments on commit 47fc72a

Please sign in to comment.