diff --git a/ChangeLog b/ChangeLog index 3972aca610ad3165f24061ed129e574efb29242d..b757d59dd45c6df3af238c5a89ade19af9b519d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.0 compared to 2.9 ***** For users: +- New: Can edit date of cheque receipts. - New: Add Sales journal and Purchase journal report. - New: Can create supplier invoice from supplier order. New: Support login by openid diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index d99b6e259d33093ca06b65dc83aa8991fc325d48..43f38c94115c644055ff7f48c01daf7c66cab7b6 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1066,7 +1066,7 @@ class Commande extends CommonObject $this->date_livraison = $this->db->jdate($obj->date_livraison); $this->fk_delivery_address = $obj->fk_adresse_livraison; $this->propale_id = $obj->fk_source; - + $this->lines = array(); if ($this->statut == 0) $this->brouillon = 1; @@ -1258,7 +1258,7 @@ class Commande extends CommonObject $line->date_end = $this->db->jdate($objp->date_end); $this->lines[$i] = $line; - + $i++; } $this->db->free($result); @@ -1551,10 +1551,10 @@ class Commande extends CommonObject /** - * \brief Set the order date - * \param user Objet utilisateur qui modifie - * \param date_livraison Date de livraison - * \return int <0 si ko, >0 si ok + * Set the order date + * @param user Object user + * @param date_livraison Date delivery + * @return int <0 if KO, >0 if OK */ function set_date($user, $date) { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 1586e47b58c662e7bff75f123c71d6962047dba2..8b6c088735fe0ce7ae17d600ee123607659486eb 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -50,8 +50,8 @@ $langs->load('propal'); $langs->load('deliveries'); $langs->load('products'); -$comid = isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:''); -if (empty($comid)) $comid=isset($_GET["orderid"])?$_GET["orderid"]:(isset($_POST["orderid"])?$_POST["orderid"]:''); +$comid = GETPOST("id"); +if (empty($comid)) $comid=GETPOST("orderid"); // Security check $socid=0; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index c54c2c4c57f67bee5b3d5a97790b12330bc1a1df..2f22a1199997e9dc8ea31667b2128b74c1f6db88 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -60,7 +60,7 @@ class RemiseCheque extends CommonObject * \brief Load record * \param id Id 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='') { @@ -103,10 +103,11 @@ class RemiseCheque extends CommonObject } $this->db->free($resql); - return 0; + return 1; } else { + $this->error=$this->db->lasterror(); 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) * \param withpicto Inclut le picto dans le lien diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index f39ba87e8a7221d51ee3b8966ae370290be7c14d..28477026a94a726e690306e6857574e0ac7847f9 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -1,6 +1,6 @@ <?php /* 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> * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ /** * \file htdocs/compta/paiement/cheque/fiche.php * \ingroup facture - * \brief Onglet paiement cheque + * \brief Tab cheque deposit * \version $Id$ */ @@ -61,6 +61,27 @@ $dir=$conf->banque->dir_output.'/bordereau/'; * 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) { $remisecheque = new RemiseCheque($db); @@ -309,6 +330,8 @@ if ($_GET['action'] == 'new') } else { + $object=$remisecheque; + $paymentstatic=new Paiement($db); $accountlinestatic=new AccountLine($db); $accountstatic=new Account($db); @@ -324,7 +347,30 @@ else print "</td>"; 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 $accountstatic->getNomUrl(1);