diff --git a/ChangeLog b/ChangeLog index 05db29b146b57ec05e584c5fd3863192c0f0c53b..c9a5e6b770174d3305d682df22f2aa7cd4b6830f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -97,6 +97,7 @@ WARNING: If you used external modules, some of them may need to be upgraded due - Fix: Can't reset payment due date - Fix: Orderstoinvoice didn't act as expected when no order was checked - Fix: Bad link to all proposals into Third party card if customer is prospect +- Fix: Some bugs on withdrawal rejects - Fix: [ bug #774 ] Bug on creating event with box "all day" crossed - Fix: [ bug #787 ] Invoice supplier box incorrect tooltip when delay on payment - Fix: [ bug #789 ] VAT not being calculated in POS diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index a6b37df813dddf5e2f4d5fc449072156e88a4538..543c0cdbab59d498297ca11905a3968d3b182892 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -1,7 +1,7 @@ <?php /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> - * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2010-2013 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 @@ -50,7 +50,7 @@ class RejetPrelevement $this->motifs = array(); $this->facturer = array(); - $this->motifs[0] = $langs->trans("StatusMotif0"); + $this->motifs[0] = ""; //$langs->trans("StatusMotif0"); $this->motifs[1] = $langs->trans("StatusMotif1"); $this->motifs[2] = $langs->trans("StatusMotif2"); $this->motifs[3] = $langs->trans("StatusMotif3"); diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index 45dc325f5c11807c91fce44a58455beb83e8e7a6..55dd526bb2aa9c75f9937771621e39a2b8dd82b1 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> - * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2010-2013 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 @@ -53,29 +53,49 @@ if ($action == 'confirm_rejet') { if ( GETPOST("confirm") == 'yes') { - $daterej = mktime(2, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int')); - - $lipre = new LignePrelevement($db, $user); - - if ($lipre->fetch($id) == 0) + if (GETPOST('remonth','int')) { + $daterej = mktime(2, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int')); + } - if (GETPOST('motif','alpha') > 0 && $daterej < time()) + if (empty($daterej)) + { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")),'errors'); + } + + elseif ($daterej > dol_now()) + { + $error++; + $langs->load("error"); + setEventMessage($langs->transnoentities("ErrorDateMustBeBeforeToday"),'errors'); + } + + if (GETPOST('motif','alpha') == 0) + { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefusedReason")),'errors'); + } + + if ( ! $error ) + { + $lipre = new LignePrelevement($db, $user); + + if ($lipre->fetch($id) == 0) + { $rej = new RejetPrelevement($db, $user); - + $rej->create($user, $id, GETPOST('motif','alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer','int')); header("Location: ligne.php?id=".$id); exit; } - else - { - dol_syslog("Motif : ".GETPOST('motif','alpha')); - dol_syslog("$daterej $time "); - header("Location: ligne.php?id=".$id."&action=rejet"); - exit; - } + + } + else + { + $action="rejet"; } } else @@ -176,13 +196,13 @@ if ($id) print '</td></tr>'; //Date - print '<tr><td class="valid">'.$langs->trans("RefusedData").'</td>'; + print '<tr><td class="fieldrequired" class="valid">'.$langs->trans("RefusedData").'</td>'; print '<td colspan="2" class="valid">'; print $form->select_date('','','','','',"confirm_rejet"); print '</td></tr>'; //Reason - print '<tr><td class="valid">'.$langs->trans("RefusedReason").'</td>'; + print '<tr><td class="fieldrequired" class="valid">'.$langs->trans("RefusedReason").'</td>'; print '<td class="valid">'; print $form->selectarray("motif", $rej->motifs); print '</td></tr>'; @@ -306,8 +326,9 @@ if ($id) dol_print_error($db); } - $db->close(); } llxFooter(); + +$db->close(); ?> diff --git a/htdocs/langs/ca_ES/errors.lang b/htdocs/langs/ca_ES/errors.lang index 5a68c272c3aca035e59b8d44ec1b62e0ea11931e..74411ee6a34d4c60112ef6491da45bf11e4c085d 100644 --- a/htdocs/langs/ca_ES/errors.lang +++ b/htdocs/langs/ca_ES/errors.lang @@ -119,6 +119,7 @@ ErrorFailedToAddToMailmanList=S'ha produït un error en intentar afegir un regis ErrorFailedToRemoveToMailmanList=Error en l'eliminació de %s de la llista Mailmain %s o base SPIP ErrorNewValueCantMatchOldValue=El Nou valor no pot ser igual al antic ErrorFailedToValidatePasswordReset=No s'ha pogut restablir la contrasenya. És possible que aquest enllaç ja s'hagi utilitzat (aquest enllaç només es pot utilitzar una vegada). Si no és el cas prova de reiniciar el procés de restabliment de contrasenya des del principi. +ErrorDateMustBeBeforeToday=La data no pot ser superior a avui # Warnings WarningMandatorySetupNotComplete=Els paràmetres obligatoris de configuració no estan encara definits diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 1f02fc11f5f2cf9e127c519999438ad3e2b9e227..47c8e2768f74c658e4e484d86fd22a8c038d8633 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -123,6 +123,7 @@ ErrorNewValueCantMatchOldValue=New value can't be equal to old one ErrorFailedToValidatePasswordReset=Failed to reinit password. May be the reinit was already done (this link can be used only one time). If not, try to restart the reinit process. ErrorToConnectToMysqlCheckInstance=Connect to database fails. Check Mysql server is running (in most cases, you can launch it from command line with 'sudo /etc/init.d/mysql start'). ErrorFailedToAddContact=Failed to add contact +ErrorDateMustBeBeforeToday=The date can not be greater than today # Warnings WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index f3b9694e4fe8175b62238dd6ff3ef99a5403c640..2b9b4d09f110a1362811c9da128a557318cff966 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -122,6 +122,7 @@ ErrorFailedToAddToMailmanList=Ha ocurrido un error al intentar añadir un regist ErrorFailedToRemoveToMailmanList=Error en la eliminación de %s de la lista Mailmain %s o base SPIP ErrorNewValueCantMatchOldValue=El nuevo valor no puede ser igual al antiguo ErrorFailedToValidatePasswordReset=No se ha podido restablecer la contraseña. Es posible que este enlace ya se haya utilizado (este enlace sólo puede usarse una vez). Si no es el caso, trate de reiniciar el proceso de restablecimiento de contraseña desde el principio. +ErrorDateMustBeBeforeToday=La fecha no puede ser superior a hoy # Warnings WarningMandatorySetupNotComplete=Los parámetros obligatorios de configuración no están todavía definidos diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 28be39d651fd57dc35c9fba41837283bd5a110f7..f3bcee9c4d97d782e9cfaab0356d320711146ff1 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -124,6 +124,7 @@ ErrorNewValueCantMatchOldValue=La nouvelle valeur ne peut être égale à l'anci ErrorFailedToValidatePasswordReset=Echec de la réinitialisation du mot de passe. Il est possible que ce lien ait déjà été utilisé (l'utilisation de ce lien ne fonctionne qu'une fois). Si ce n'est pas le cas, essayer de recommencer le processus de réinit de mot de passe depuis le début. ErrorToConnectToMysqlCheckInstance=Echec de la connection au serveur de base de donnée. Vérifier que Mysql est bien lancé (dans la plupart des cas, vous pouvez le lancer depuis la ligne de commande par la commande 'sudo /etc/init.d/mysql start'). ErrorFailedToAddContact=Echec à l'ajout du contact +ErrorDateMustBeBeforeToday=La date ne peut pas être supérieure à aujourd'hui # Warnings WarningMandatorySetupNotComplete=Les informations de configuration obligatoire doivent être renseignées