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

This commit is contained in:
Laurent Destailleur 2014-03-29 17:38:29 +01:00
commit 81306ff1d0
20 changed files with 162 additions and 63 deletions

View File

@ -65,6 +65,7 @@ For developers:
action buttons into an element. action buttons into an element.
- New: Normalize code for barcode generation to match other modules. - New: Normalize code for barcode generation to match other modules.
- New: Uniformize code for contacts forms. - New: Uniformize code for contacts forms.
- New: Add some hooks for financial reports.
WARNING: Following change may create regression for some external modules, but was necessary to make WARNING: Following change may create regression for some external modules, but was necessary to make
Dolibarr better: Dolibarr better:
@ -116,6 +117,7 @@ Fix: [ bug #1280 ] service with not end of date was tagged as expired.
Fix: [ bug #1295 ] Error when creating an agenda extrafield with a number as reference Fix: [ bug #1295 ] Error when creating an agenda extrafield with a number as reference
Fix: [ bug #1306 ] Fatal error when adding an external calendar Fix: [ bug #1306 ] Fatal error when adding an external calendar
New: Added es_CL language New: Added es_CL language
Fix: Margin tabs bad data show
***** ChangeLog for 3.5 compared to 3.4.* ***** ***** ChangeLog for 3.5 compared to 3.4.* *****
For users: For users:

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> /* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -153,6 +154,17 @@ print "<td align=\"right\">".$vatcust."</td>";
print "</tr>\n"; print "</tr>\n";
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell'); $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell');
$action = "tvaclient";
$object = &$coll_list;
$parameters["mode"] = $modetax;
$parameters["start"] = $date_start;
$parameters["end"] = $date_end;
$parameters["direction"] = 'sell';
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list)) if (is_array($coll_list))
{ {
$var=true; $var=true;
@ -160,7 +172,7 @@ if (is_array($coll_list))
$i = 1; $i = 1;
foreach($coll_list as $coll) foreach($coll_list as $coll)
{ {
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2>0) if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2!=0)
{ {
$var=!$var; $var=!$var;
$intra = str_replace($find,$replace,$coll->tva_intra); $intra = str_replace($find,$replace,$coll->tva_intra);
@ -222,6 +234,8 @@ print "</tr>\n";
$company_static=new Societe($db); $company_static=new Societe($db);
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy'); $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
$parameters["direction"] = 'buy';
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list)) if (is_array($coll_list))
{ {
$var=true; $var=true;
@ -229,7 +243,7 @@ if (is_array($coll_list))
$i = 1; $i = 1;
foreach($coll_list as $coll) foreach($coll_list as $coll)
{ {
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2>0) if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2!=0)
{ {
$var=!$var; $var=!$var;
$intra = str_replace($find,$replace,$coll->tva_intra); $intra = str_replace($find,$replace,$coll->tva_intra);

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> /* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -134,6 +135,15 @@ for ($m = 1 ; $m < 13 ; $m++ )
{ {
$coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m); $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m);
$coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m); $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m);
$action = "tva";
$object = array(&$coll_listsell, &$coll_listbuy);
$parameters["mode"] = $modetax;
$parameters["year"] = $y;
$parameters["month"] = $m;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (! is_array($coll_listbuy) && $coll_listbuy == -1) if (! is_array($coll_listbuy) && $coll_listbuy == -1)
{ {
@ -181,7 +191,7 @@ for ($m = 1 ; $m < 13 ; $m++ )
print '<td align="right">'.$langs->trans("SubTotal").':</td>'; print '<td align="right">'.$langs->trans("SubTotal").':</td>';
print '<td class="nowrap" align="right">'.price($subtotalcoll).'</td>'; print '<td class="nowrap" align="right">'.price($subtotalcoll).'</td>';
print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td>'; print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td>';
print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td>'; print '<td class="nowrap" align="right">'.price($subtotal).'</td>';
print '<td>&nbsp;</td></tr>'; print '<td>&nbsp;</td></tr>';
$i = 0; $i = 0;
$subtotalcoll=0; $subtotalpaye=0; $subtotal=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0;

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -729,6 +730,16 @@ if ($mysoc->tva_assuj != 'franchise') // Assujeti
print '</tr>'; print '</tr>';
} }
$action = "balanceclient";
$object = array(&$total_ht, &$total_ttc);
$parameters["mode"] = $modecompta;
$parameters["date_start"] = $date_start;
$parameters["date_end"] = $date_end;
$parameters["bc"] = $bc;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
print $hookmanager->resPrint;
if ($mysoc->tva_assuj != 'franchise') // Assujeti if ($mysoc->tva_assuj != 'franchise') // Assujeti
{ {

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -461,8 +462,12 @@ if ($result) {
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
$action = "balance";
$object = array(&$encaiss, &$encaiss_ttc, &$decaiss, &$decaiss_ttc);
$parameters["mode"] = $modecompta;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
/* /*
* Show result array * Show result array

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Yannick Warnier <ywarnier@beeznest.org> * Copyright (C) 2006 Yannick Warnier <ywarnier@beeznest.org>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -185,6 +186,17 @@ print "<td align=\"right\">".$vatcust."</td>";
print "</tr>\n"; print "</tr>\n";
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell'); $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell');
$action = "tvaclient";
$object = &$coll_list;
$parameters["mode"] = $modetax;
$parameters["start"] = $date_start;
$parameters["end"] = $date_end;
$parameters["direction"] = 'sell';
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list)) if (is_array($coll_list))
{ {
$var=true; $var=true;
@ -263,6 +275,9 @@ print "</tr>\n";
$company_static=new Societe($db); $company_static=new Societe($db);
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy'); $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
$parameters["direction"] = 'buy';
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list)) if (is_array($coll_list))
{ {
$var=true; $var=true;

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -153,6 +154,15 @@ for ($m = 1 ; $m < 13 ; $m++ )
{ {
$coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m); $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m);
$coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m); $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m);
$action = "tva";
$object = array(&$coll_listsell, &$coll_listbuy);
$parameters["mode"] = $modetax;
$parameters["year"] = $y;
$parameters["month"] = $m;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (! is_array($coll_listbuy) && $coll_listbuy == -1) if (! is_array($coll_listbuy) && $coll_listbuy == -1)
{ {

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org> * Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -318,7 +319,16 @@ else
print '<td align="right">'.$langs->trans("AmountHTVATRealReceived").'</td>'; print '<td align="right">'.$langs->trans("AmountHTVATRealReceived").'</td>';
print '<td align="right">'.$vatcust.'</td>'; print '<td align="right">'.$vatcust.'</td>';
print '</tr>'; print '</tr>';
$action = "tvadetail";
$parameters["mode"] = $modetax;
$parameters["start"] = $date_start;
$parameters["end"] = $date_end;
$object = array(&$x_coll, &$x_paye, &$x_both);
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
foreach(array_keys($x_coll) as $rate) foreach(array_keys($x_coll) as $rate)
{ {
$subtot_coll_total_ht = 0; $subtot_coll_total_ht = 0;

View File

@ -72,8 +72,10 @@ class box_ficheinter extends ModeleBoxes
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f"; $sql.= ", ".MAIN_DB_PREFIX."fichinter as f";
$sql.= " WHERE f.fk_soc = s.rowid "; $sql.= " WHERE f.fk_soc = s.rowid ";
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if (! $user->rights->societe->client->voir) if (! $user->rights->societe->client->voir && !$user->societe_id)
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
$sql.= " ORDER BY f.tms DESC"; $sql.= " ORDER BY f.tms DESC";
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);

View File

@ -342,12 +342,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Date start // Date start
print '<td align="center">'; print '<td align="center">';
print dol_print_date($lines[$i]->date_start,'day'); print dol_print_date($lines[$i]->date_start,'dayhour');
print '</td>'; print '</td>';
// Date end // Date end
print '<td align="center">'; print '<td align="center">';
print dol_print_date($lines[$i]->date_end,'day'); print dol_print_date($lines[$i]->date_end,'dayhour');
print '</td>'; print '</td>';
// Planned Workload (in working hours) // Planned Workload (in working hours)
@ -500,12 +500,12 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
// Date start // Date start
print '<td align="center">'; print '<td align="center">';
print dol_print_date($lines[$i]->date_start,'day'); print dol_print_date($lines[$i]->date_start,'dayhour');
print '</td>'; print '</td>';
// Date end // Date end
print '<td align="center">'; print '<td align="center">';
print dol_print_date($lines[$i]->date_end,'day'); print dol_print_date($lines[$i]->date_end,'dayhour');
print '</td>'; print '</td>';
// Planned Workload // Planned Workload

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file expedtion/class/productbatch.class.php * \file expedition/class/productbatch.class.php
* \ingroup productbatch * \ingroup productbatch
* \brief This file implements CRUD method for managing product's shipment * \brief This file implements CRUD method for managing product's shipment
* with batch record * with batch record

View File

@ -856,7 +856,7 @@ if ($action == 'create')
if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0; if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0;
} }
if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) { if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() and is_array($product->stock_warehouse[GETPOST('entrepot_id','int')] ))) {
// Quantity to send // Quantity to send
print '<td align="center">'; print '<td align="center">';
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
@ -897,27 +897,27 @@ if ($action == 'create')
print "</tr>\n"; print "</tr>\n";
// Show subproducts of product // Show subproducts of product
if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0)
{ {
$product->get_sousproduits_arbo(); $product->get_sousproduits_arbo();
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom); $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
if(count($prods_arbo) > 0) if(count($prods_arbo) > 0)
{ {
foreach($prods_arbo as $key => $value) foreach($prods_arbo as $key => $value)
{ {
//print $value[0]; //print $value[0];
$img=''; $img='';
if ($value['stock'] < $value['stock_alert']) if ($value['stock'] < $value['stock_alert'])
{ {
$img=img_warning($langs->trans("StockTooLow")); $img=img_warning($langs->trans("StockTooLow"));
} }
print "<tr ".$bc[$var]."><td>&nbsp; &nbsp; &nbsp; -> print "<tr ".$bc[$var]."><td>&nbsp; &nbsp; &nbsp; ->
<a href=\"".DOL_URL_ROOT."/product/fiche.php?id=".$value['id']."\">".$value['fullpath']." <a href=\"".DOL_URL_ROOT."/product/fiche.php?id=".$value['id']."\">".$value['fullpath']."
</a> (".$value['nb'].")</td><td align=\"center\"> ".$value['nb_total']."</td><td>&nbsp</td><td>&nbsp</td> </a> (".$value['nb'].")</td><td align=\"center\"> ".$value['nb_total']."</td><td>&nbsp</td><td>&nbsp</td>
<td align=\"center\">".$value['stock']." ".$img."</td></tr>"; <td align=\"center\">".$value['stock']." ".$img."</td></tr>";
} }
} }
} }
} else { } else {
print '<td></td><td></td></tr>'; print '<td></td><td></td></tr>';
$subj=0; $subj=0;

View File

@ -29,4 +29,6 @@ create table llx_stock_mouvement
type_mouvement smallint, type_mouvement smallint,
fk_user_author integer, fk_user_author integer,
label varchar(128) label varchar(128)
fk_origin integer,
origintype varchar(32)
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -1,6 +1,6 @@
# Dolibarr language file - fr_BE - main # Dolibarr language file - fr_BE - main
SeparatorDecimal=, SeparatorDecimal=,
SeparatorThousand=None SeparatorThousand=
FormatDateShort=%d/%m/%Y FormatDateShort=%d/%m/%Y
FormatDateShortInput=%d/%m/%Y FormatDateShortInput=%d/%m/%Y
FormatDateShortJava=dd/MM/yyyy FormatDateShortJava=dd/MM/yyyy

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> /* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -130,11 +131,14 @@ if ($agentid > 0) {
else else
$sql .= " AND sc.fk_user = ".$agentid; $sql .= " AND sc.fk_user = ".$agentid;
} }
if (!empty($startdate)) $sql.= " AND f.datef >= '".$db->idate($startdate)."'"; if (!empty($startdate))
if (!empty($enddate)) $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; $sql.= " AND f.datef >= '".$db->idate($startdate)."'";
if (!empty($enddate))
$sql.= " AND f.datef <= '".$db->idate($enddate)."'";
$sql .= " AND d.buy_price_ht IS NOT NULL"; $sql .= " AND d.buy_price_ht IS NOT NULL";
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0";
$sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname"; if($agentid) $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname";
else $sql.= " GROUP BY u.rowid, u.login, u.lastname, u.firstname";
$sql.= " ORDER BY ".$sortfield." ".$sortorder; $sql.= " ORDER BY ".$sortfield." ".$sortorder;
// TODO: calculate total to display then restore pagination // TODO: calculate total to display then restore pagination
//$sql.= $db->plimit($conf->liste_limit +1, $offset); //$sql.= $db->plimit($conf->liste_limit +1, $offset);

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> /* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -172,13 +173,18 @@ $sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.fk_statut > 0"; $sql.= " AND f.fk_statut > 0";
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
$sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_facture = f.rowid";
if ($client) $sql.= " AND f.fk_soc = ".$socid; if ($client)
if (!empty($startdate)) $sql.= " AND f.datef >= '".$db->idate($startdate)."'"; $sql.= " AND f.fk_soc = ".$socid;
if (!empty($enddate)) $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; if (!empty($startdate))
$sql.= " AND f.datef >= '".$db->idate($startdate)."'";
if (!empty($enddate))
$sql.= " AND f.datef <= '".$db->idate($enddate)."'";
$sql .= " AND d.buy_price_ht IS NOT NULL"; $sql .= " AND d.buy_price_ht IS NOT NULL";
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
$sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; $sql .= " AND d.buy_price_ht <> 0";
$sql.= " ORDER BY ".$sortfield." ".$sortorder; if ($client) $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut";
else $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client";
$sql.= " ORDER BY $sortfield $sortorder ";
// TODO: calculate total to display then restore pagination // TODO: calculate total to display then restore pagination
//$sql.= $db->plimit($conf->liste_limit +1, $offset); //$sql.= $db->plimit($conf->liste_limit +1, $offset);

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> /* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -178,12 +179,19 @@ $sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND d.fk_product = p.rowid"; $sql.= " AND d.fk_product = p.rowid";
$sql.= " AND f.fk_statut > 0"; $sql.= " AND f.fk_statut > 0";
$sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_facture = f.rowid";
if ($id > 0) $sql.= " AND d.fk_product =".$id; if ($id > 0)
if (!empty($startdate)) $sql.= " AND f.datef >= '".$db->idate($startdate)."'"; $sql.= " AND d.fk_product =".$id;
if (!empty($enddate)) $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; if (!empty($startdate))
$sql.= " AND f.datef >= '".$db->idate($startdate)."'";
if (!empty($enddate))
$sql.= " AND f.datef <= '".$db->idate($enddate)."'";
$sql .= " AND d.buy_price_ht IS NOT NULL"; $sql .= " AND d.buy_price_ht IS NOT NULL";
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
$sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; $sql .= " AND d.buy_price_ht <> 0";
if ($id > 0)
$sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut";
else
$sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref";
$sql.= " ORDER BY ".$sortfield." ".$sortorder; $sql.= " ORDER BY ".$sortfield." ".$sortorder;
// TODO: calculate total to display then restore pagination // TODO: calculate total to display then restore pagination
//$sql.= $db->plimit($conf->liste_limit +1, $offset); //$sql.= $db->plimit($conf->liste_limit +1, $offset);

View File

@ -537,8 +537,8 @@ if ($resql)
$productidselected=$key; $productidselected=$key;
$productlabelselected=$val; $productlabelselected=$val;
} }
$datebefore=dol_get_first_day($year, $month?$month:1, true); $datebefore=dol_get_first_day($year?$year:strftime("%Y",time()), $month?$month:1, true);
$dateafter=dol_get_last_day($year, $month?$month:12, true); $dateafter=dol_get_last_day($year?$year:strftime("%Y",time()), $month?$month:12, true);
$balancebefore=$movement->calculateBalanceForProductBefore($productidselected, $datebefore); $balancebefore=$movement->calculateBalanceForProductBefore($productidselected, $datebefore);
$balanceafter=$movement->calculateBalanceForProductBefore($productidselected, $dateafter); $balanceafter=$movement->calculateBalanceForProductBefore($productidselected, $dateafter);

View File

@ -83,8 +83,8 @@ if ($action == 'createtask' && $user->rights->projet->creer)
{ {
$error=0; $error=0;
$date_start = dol_mktime(0,0,0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']); $date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyeassskr'],'user');
$date_end = dol_mktime(0,0,0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']); $date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user');
if (empty($_POST["cancel"])) if (empty($_POST["cancel"]))
{ {
@ -232,12 +232,12 @@ if ($id > 0 || ! empty($ref))
// Date start // Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>'; print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print dol_print_date($object->date_start,'day'); print dol_print_date($object->date_start,'dayhour');
print '</td></tr>'; print '</td></tr>';
// Date end // Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>'; print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($object->date_end,'day'); print dol_print_date($object->date_end,'dayhour');
print '</td></tr>'; print '</td></tr>';
// Other options // Other options
@ -302,12 +302,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie
// Date start // Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>'; print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print $form->select_date(($date_start?$date_start:''),'dateo',0,0,0,'',1,1); print $form->select_date(($date_start?$date_start:''),'dateo',1,1,0,'',1,1);
print '</td></tr>'; print '</td></tr>';
// Date end // Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>'; print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
print $form->select_date(($date_end?$date_end:-1),'datee',0,0,0,'',1,1); print $form->select_date(($date_end?$date_end:-1),'datee',1,1,0,'',1,1);
print '</td></tr>'; print '</td></tr>';
// planned workload // planned workload

View File

@ -83,8 +83,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
$object->description = $_POST['description']; $object->description = $_POST['description'];
$object->fk_task_parent = $task_parent; $object->fk_task_parent = $task_parent;
$object->planned_workload = $planned_workload; $object->planned_workload = $planned_workload;
$object->date_start = dol_mktime(0,0,0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']); $object->date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user');
$object->date_end = dol_mktime(0,0,0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']); $object->date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user');
$object->progress = $_POST['progress']; $object->progress = $_POST['progress'];
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
@ -322,12 +322,12 @@ if ($id > 0 || ! empty($ref))
// Date start // Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>'; print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print $form->select_date($object->date_start,'dateo'); print $form->select_date($object->date_start,'dateo',1,1);
print '</td></tr>'; print '</td></tr>';
// Date end // Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>'; print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
print $form->select_date($object->date_end?$object->date_end:-1,'datee'); print $form->select_date($object->date_end?$object->date_end:-1,'datee',1,1);
print '</td></tr>'; print '</td></tr>';
// Planned workload // Planned workload
@ -411,12 +411,12 @@ if ($id > 0 || ! empty($ref))
// Date start // Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateStart").'</td><td colspan="3">';
print dol_print_date($object->date_start,'day'); print dol_print_date($object->date_start,'dayhour');
print '</td></tr>'; print '</td></tr>';
// Date end // Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateEnd").'</td><td colspan="3">';
print dol_print_date($object->date_end,'day'); print dol_print_date($object->date_end,'dayhour');
print '</td></tr>'; print '</td></tr>';
// Planned workload // Planned workload