diff --git a/htdocs/compta/prelevement/bon.php b/htdocs/compta/prelevement/bon.php deleted file mode 100644 index 20d60c3a55b48353e7dc4f409c5d7109faa0d3c8..0000000000000000000000000000000000000000 --- a/htdocs/compta/prelevement/bon.php +++ /dev/null @@ -1,103 +0,0 @@ -<?php -/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2010-2012 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/** - * \file htdocs/compta/prelevement/bon.php - * \ingroup prelevement - * \brief Fiche apercu du bon de prelevement - */ - -require('../../main.inc.php'); -require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); -$langs->load("bills"); -$langs->load("categories"); - -// Security check -$socid=0; -$id = GETPOST('id','int'); -$ref = GETPOST('ref','alpha'); -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'prelevement', $id); - - -llxHeader('','Bon de prelevement'); - -$form = new Form($db); - -if ($id > 0 || ! empty($ref)) -{ - $object = new BonPrelevement($db,""); - - if ($object->fetch($id) == 0) - { - $head = prelevement_prepare_head($object); - dol_fiche_head($head, 'preview', 'Prelevement : '. $object->ref); - - print '<table class="border" width="100%">'; - - print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$object->ref.'</td></tr>'; - print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>'; - print '<tr><td width="20%">'.$langs->trans("File").'</td><td>'; - - $relativepath = 'bon/'.$object->ref; - - print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$object->ref.'</a>'; - - print '</td></tr>'; - print '</table><br>'; - - $fileimage = $conf->prelevement->dir_output.'/receipts/'.$object->ref.'.ps.png.0'; - $fileps = $conf->prelevement->dir_output.'/receipts/'.$object->ref.'.ps'; - - // Conversion du PDF en image png si fichier png non existant - if (!file_exists($fileimage)) - { - if (class_exists("Imagick")) - { - $ret = dol_convert_file($file,'png',$fileimage); - if ($ret < 0) $error++; - } - else - { - $langs->load("errors"); - print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>'; - } - } - - if (file_exists($fileimage)) - { - print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=prelevement&file='.urlencode(basename($fileimage)).'">'; - - } - - dol_fiche_end(); - } - else - { - dol_print_error($db); - } -} - -llxFooter(); diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 87bab387344a4511706bee01bb5f516e016795cd..66a1c81e8e988d0a8753c56d57d6077bbdaa301b 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -821,7 +821,9 @@ class BonPrelevement extends CommonObject { $bac = new CompanyBankAccount($this->db); $bac->fetch(0,$soc->id); + if ($bac->verif() >= 1) + //if (true) { $factures_prev[$i] = $fac; /* second tableau necessaire pour BonPrelevement */ @@ -1226,26 +1228,24 @@ class BonPrelevement extends CommonObject * @return int 0 if OK, <0 if KO */ //TODO: Optimize code to read lines in a single function - function Generate() + function generate() { global $conf,$langs,$mysoc; $result = 0; - dol_syslog(get_class($this)."::Generate build file ".$this->filename); + dol_syslog(get_class($this)."::generate build file ".$this->filename); $this->file = fopen($this->filename,"w"); $found=0; // Build file for European countries - if (! $mysoc->isInEEC()) + if ($mysoc->isInEEC()) { $found++; /** - * SECTION CREATION FICHIER SEPA - * SECTION CREATION FICHIER SEPA * SECTION CREATION FICHIER SEPA */ // SEPA Initialisation @@ -1308,8 +1308,6 @@ class BonPrelevement extends CommonObject } /** - * SECTION CREATION FICHIER SEPA - * SECTION CREATION FICHIER SEPA * SECTION CREATION FICHIER SEPA */ // SEPA File Header @@ -1401,11 +1399,14 @@ class BonPrelevement extends CommonObject } } else - { + { $result = -2; } + $langs->load('withdrawals'); - fputs($this->file, $langs->trans('WithdrawalFileNotCapable')); + + // TODO Add here code to generate a generic file + fputs($this->file, $langs->trans('WithdrawalFileNotCapable', $mysoc->country_code)); } fclose($this->file); diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 27ae87ca3b4319ee78c3fada6f1ebd3e6fad42a2..d0b467f294ba287b3b85c9bf75f1b3b8b49e7ce7 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -173,7 +173,8 @@ class RejetPrelevement } //Tag invoice as unpaid dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref); - $fac->set_unpaid($fac->id, $user); + + $fac->set_unpaid($user); //TODO: Must be managed by notifications module // Send email to sender of the standing order request @@ -194,7 +195,7 @@ class RejetPrelevement } /** - * Envoi mail + * Send email to all users that has asked the withdraw request * * @param Facture $fac Invoice object * @return void diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index c99744f7430ac3a6a215039e62c77bd7ed4d5e1c..364e073676bd355c9012d4bcf26b9133e742d336 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("banks"); $langs->load("categories"); -$langs->load("widthdrawals"); +$langs->load("withdrawals"); $langs->load("companies"); // Security check diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index b3f9acb35709cffa2b8a0065197fa59e99d27a28..f16179796451881c88579c79218c387b2bab5c01 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -105,10 +105,13 @@ if ($action == 'confirm_rejet') } } + /* * View */ +$invoicestatic=new Facture($db); + llxHeader('',$langs->trans("StandingOrder")); $h = 0; @@ -134,9 +137,7 @@ if ($id) print '<a href="card.php?id='.$lipre->bon_rowid.'">'.$lipre->bon_ref.'</a></td></tr>'; print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>'; - print '<tr><td width="20%">'.$langs->trans("Status").'</td><td>'; - - print $lipre->LibStatut($lipre->statut,1).'</td></tr>'; + print '<tr><td width="20%">'.$langs->trans("Status").'</td><td>'.$lipre->LibStatut($lipre->statut,1).'</td></tr>'; if ($lipre->statut == 3) { @@ -215,7 +216,7 @@ if ($id) print '</table><br>'; //Confirm Button - print '<center><input type="submit" class="valid" value='.$langs->trans("Confirm").'><center>'; + print '<center><input type="submit" class="button" value='.$langs->trans("Confirm").'><center>'; print '</form>'; } @@ -229,13 +230,20 @@ if ($id) if ($action == '') { - if ($bon->statut == 2 && $lipre->statut == 2 && $user->rights->prelevement->bons->credit) + if ($bon->statut == 2 && $lipre->statut == 2) { - print "<a class=\"butAction\" href=\"ligne.php?action=rejet&id=$lipre->id\">".$langs->trans("StandingOrderReject")."</a>"; + if ($user->rights->prelevement->bons->credit) + { + print "<a class=\"butAction\" href=\"ligne.php?action=rejet&id=$lipre->id\">".$langs->trans("StandingOrderReject")."</a>"; + } + else + { + print "<a class=\"butActionRefused\" href=\"#\" title=\"".$langs->trans("NotAllowed")."\">".$langs->trans("StandingOrderReject")."</a>"; + } } else { - print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("StandingOrderReject")."</a>"; + print "<a class=\"butActionRefused\" href=\"#\" title=\"".$langs->trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject")."</a>"; } } @@ -256,7 +264,7 @@ if ($id) * Liste des factures */ $sql = "SELECT pf.rowid"; - $sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc"; + $sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc, f.paye, f.fk_statut"; $sql.= " , s.rowid as socid, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; @@ -287,7 +295,7 @@ if ($id) print"\n<!-- debut table -->\n"; print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; print '<tr class="liste_titre">'; - print '<td>'.$langs->trans("Invoice").'</td><td>'.$langs->trans("ThirdParty").'</td><td align="right">'.$langs->trans("Amount").'</td>'; + print '<td>'.$langs->trans("Invoice").'</td><td>'.$langs->trans("ThirdParty").'</td><td align="right">'.$langs->trans("Amount").'</td><td align="right">'.$langs->trans("Status").'</td>'; print '</tr>'; $var=True; @@ -312,6 +320,11 @@ if ($id) print '<td align="right">'.price($obj->total_ttc)."</td>\n"; + print '<td align="right">'; + $invoicestatic->fetch($obj->facid); + print $invoicestatic->getLibStatut(5); + print "</td>\n"; + print "</tr>\n"; $i++; diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index 257f13558ee261f55b2ea5994e374144b5389fec..53f54d66f70f04d84d047509ae223ee657ff40c2 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -44,14 +44,6 @@ function prelevement_prepare_head($object) $head[$h][2] = 'prelevement'; $h++; - if (! empty($conf->global->MAIN_USE_PREVIEW_TABS)) - { - $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$object->id; - $head[$h][1] = $langs->trans("Preview"); - $head[$h][2] = 'preview'; - $h++; - } - $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$object->id; $head[$h][1] = $langs->trans("Lines"); $head[$h][2] = 'lines'; diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index dccee9d0c8eb7068ff487dadf2cc403b796ff1b0..35cfa23d9e2d7ab038ffcfa49664af822e0ddad9 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -16,6 +16,7 @@ WithdrawedBills=Withdrawn invoices WithdrawalsLines=Withdrawal lines RequestStandingOrderToTreat=Request for standing orders to process RequestStandingOrderTreated=Request for standing orders processed +NotPossibleForThisStatusOfWithdrawReceiptORLine=Not yet possible. Withdraw status must be set to 'credited' before declaring reject on specific lines. CustomersStandingOrders=Customer standing orders CustomerStandingOrder=Customer standing order NbOfInvoiceToWithdraw=Nb. of invoice with withdraw request @@ -76,7 +77,7 @@ WithBankUsingRIB=For bank accounts using RIB WithBankUsingBANBIC=For bank accounts using IBAN/BIC/SWIFT BankToReceiveWithdraw=Bank account to receive withdraws CreditDate=Credit on -WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country +WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country %s (Your country is not supported) ShowWithdraw=Show Withdraw IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one withdrawal payment not yet processed, it won't be set as paid to allow prior withdrawal management. DoStandingOrdersBeforePayments=This tab allows you to request a standing order. Once it is complete, you can type the payment to close the invoice.