diff --git a/ChangeLog b/ChangeLog
index 33d948133b1..f91e2ea35a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@ For users:
- New: Can export into Excel 2007 format.
- New: Add hidden option CASHDESK_FORCE_STOCK_ON_BILL
- New: Can search on part of barcode into POS module.
+- New: Cheques into cheques receipts are ordered by operation date.
- Fix: Can use POS module with several concurrent users.
For developers:
diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
index 36e21e6c11a..0a1fbb8c9f0 100644
--- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php
+++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
@@ -56,9 +56,9 @@ class RemiseCheque extends CommonObject
/**
* Load record
*
- * @param id Id record
- * @param ref Ref record
- * @return int <0 if KO, > 0 if OK
+ * @param int $id Id record
+ * @param string $ref Ref record
+ * @return int <0 if KO, > 0 if OK
*/
function fetch($id,$ref='')
{
@@ -72,7 +72,7 @@ class RemiseCheque extends CommonObject
$sql.= " WHERE bc.entity = ".$conf->entity;
if ($id) $sql.= " AND bc.rowid = ".$id;
if ($ref) $sql.= " AND bc.number = '".$this->db->escape($ref)."'";
-
+
dol_syslog("RemiseCheque::fetch sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
@@ -503,14 +503,14 @@ class RemiseCheque extends CommonObject
$sql.= " AND b.fk_bordereau = bc.rowid";
$sql.= " AND bc.rowid = ".$this->id;
$sql.= " AND bc.entity = ".$conf->entity;
- $sql.= " ORDER BY b.emetteur ASC, b.rowid ASC;";
+ $sql.= " ORDER BY b.dateo ASC, b.rowid ASC";
dol_syslog("RemiseCheque::generatePdf sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
$i = 0;
- while ( $objp = $this->db->fetch_object($result) )
+ while ($objp = $this->db->fetch_object($result))
{
$docmodel->lines[$i]->bank_chq = $objp->banque;
$docmodel->lines[$i]->emetteur_chq = $objp->emetteur;
@@ -531,7 +531,7 @@ class RemiseCheque extends CommonObject
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
- $sav_charset_output=$outputlangs->charset_output;
+ $sav_charseSupprimert_output=$outputlangs->charset_output;
$result=$docmodel->write_file($conf->banque->dir_output.'/bordereau', $this->number, $outputlangs);
if ($result > 0)
{
diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php
index 7a687d7a67b..a2933c0959a 100644
--- a/htdocs/compta/paiement/cheque/fiche.php
+++ b/htdocs/compta/paiement/cheque/fiche.php
@@ -46,11 +46,11 @@ $result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldid
$mesg='';
-$sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
-$sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
+$sortfield=GETPOST("sortfield");
+$sortorder=GETPOST("sortorder");
$page=$_GET["page"];
if (! $sortorder) $sortorder="ASC";
-if (! $sortfield) $sortfield="b.emetteur";
+if (! $sortfield) $sortfield="b.dateo,b.rowid";
if ($page < 0) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
@@ -309,15 +309,15 @@ if ($action == 'new')
print '