Fix: Cheque receipt has always a bad date because date of receipt was date of creation
This commit is contained in:
parent
a14298cf93
commit
b602316c40
@ -3,6 +3,7 @@ English Dolibarr ChangeLog
|
|||||||
***** ChangeLog for 3.0 compared to 2.9 *****
|
***** ChangeLog for 3.0 compared to 2.9 *****
|
||||||
|
|
||||||
For users:
|
For users:
|
||||||
|
- New: Can edit date of cheque receipts.
|
||||||
- New: Add Sales journal and Purchase journal report.
|
- New: Add Sales journal and Purchase journal report.
|
||||||
- New: Can create supplier invoice from supplier order.
|
- New: Can create supplier invoice from supplier order.
|
||||||
New: Support login by openid
|
New: Support login by openid
|
||||||
|
|||||||
@ -1551,10 +1551,10 @@ class Commande extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set the order date
|
* Set the order date
|
||||||
* \param user Objet utilisateur qui modifie
|
* @param user Object user
|
||||||
* \param date_livraison Date de livraison
|
* @param date_livraison Date delivery
|
||||||
* \return int <0 si ko, >0 si ok
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function set_date($user, $date)
|
function set_date($user, $date)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -50,8 +50,8 @@ $langs->load('propal');
|
|||||||
$langs->load('deliveries');
|
$langs->load('deliveries');
|
||||||
$langs->load('products');
|
$langs->load('products');
|
||||||
|
|
||||||
$comid = isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:'');
|
$comid = GETPOST("id");
|
||||||
if (empty($comid)) $comid=isset($_GET["orderid"])?$_GET["orderid"]:(isset($_POST["orderid"])?$_POST["orderid"]:'');
|
if (empty($comid)) $comid=GETPOST("orderid");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
|
|||||||
@ -60,7 +60,7 @@ class RemiseCheque extends CommonObject
|
|||||||
* \brief Load record
|
* \brief Load record
|
||||||
* \param id Id record
|
* \param id Id record
|
||||||
* \param ref Ref record
|
* \param ref Ref record
|
||||||
* \return int <0 if KO, >= 0 if OK
|
* \return int <0 if KO, > 0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id,$ref='')
|
function fetch($id,$ref='')
|
||||||
{
|
{
|
||||||
@ -103,10 +103,11 @@ class RemiseCheque extends CommonObject
|
|||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -656,6 +657,41 @@ class RemiseCheque extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the creation date
|
||||||
|
* @param user Object user
|
||||||
|
* @param date Date creation
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function set_date($user, $date)
|
||||||
|
{
|
||||||
|
if ($user->rights->banque->cheque)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||||
|
$sql.= " SET date_bordereau = ".($date ? $this->db->idate($date) : 'null');
|
||||||
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
dol_syslog("RemiseCheque::set_date sql=$sql",LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$this->date_bordereau = $date;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
dol_syslog("RemiseCheque::set_date ".$this->error,LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie nom clicable (avec eventuellement le picto)
|
* \brief Renvoie nom clicable (avec eventuellement le picto)
|
||||||
* \param withpicto Inclut le picto dans le lien
|
* \param withpicto Inclut le picto dans le lien
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -21,7 +21,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/compta/paiement/cheque/fiche.php
|
* \file htdocs/compta/paiement/cheque/fiche.php
|
||||||
* \ingroup facture
|
* \ingroup facture
|
||||||
* \brief Onglet paiement cheque
|
* \brief Tab cheque deposit
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -61,6 +61,27 @@ $dir=$conf->banque->dir_output.'/bordereau/';
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ($_POST['action'] == 'setdate' && $user->rights->banque->cheque)
|
||||||
|
{
|
||||||
|
$remisecheque = new RemiseCheque($db);
|
||||||
|
$result = $remisecheque->fetch(GETPOST('id'));
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||||
|
$date=dol_mktime(0, 0, 0, $_POST['datecreate_month'], $_POST['datecreate_day'], $_POST['datecreate_year']);
|
||||||
|
|
||||||
|
$result=$remisecheque->set_date($user,$date);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$remisecheque->error.'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$remisecheque->error.'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($_GET['action'] == 'create' && $_GET["accountid"] > 0 && $user->rights->banque->cheque)
|
if ($_GET['action'] == 'create' && $_GET["accountid"] > 0 && $user->rights->banque->cheque)
|
||||||
{
|
{
|
||||||
$remisecheque = new RemiseCheque($db);
|
$remisecheque = new RemiseCheque($db);
|
||||||
@ -309,6 +330,8 @@ if ($_GET['action'] == 'new')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$object=$remisecheque;
|
||||||
|
|
||||||
$paymentstatic=new Paiement($db);
|
$paymentstatic=new Paiement($db);
|
||||||
$accountlinestatic=new AccountLine($db);
|
$accountlinestatic=new AccountLine($db);
|
||||||
$accountstatic=new Account($db);
|
$accountstatic=new Account($db);
|
||||||
@ -324,7 +347,30 @@ else
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('DateCreation').'</td><td colspan="2">'.dol_print_date($remisecheque->date_bordereau,'day').'</td></tr>';
|
print '<tr><td>';
|
||||||
|
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('Date');
|
||||||
|
print '</td>';
|
||||||
|
if ($_GET['action'] != 'editdate') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td colspan="2">';
|
||||||
|
if ($_GET['action'] == 'editdate')
|
||||||
|
{
|
||||||
|
print '<form name="setdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="setdate">';
|
||||||
|
$html->select_date($object->date_bordereau,'datecreate_','','','',"setdate");
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $object->date_bordereau ? dol_print_date($object->date_bordereau,'day') : ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('Account').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('Account').'</td><td colspan="2">';
|
||||||
print $accountstatic->getNomUrl(1);
|
print $accountstatic->getNomUrl(1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user