diff --git a/htdocs/compta/prelevement/bon.php b/htdocs/compta/prelevement/bon.php deleted file mode 100644 index 20d60c3a55b..00000000000 --- a/htdocs/compta/prelevement/bon.php +++ /dev/null @@ -1,103 +0,0 @@ - - * Copyright (C) 2005 Laurent Destailleur - * Copyright (C) 2010-2012 Juanjo Menent - * - * 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 . - */ - -/** - * \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 ''; - - print ''; - print ''; - print ''; - print '
'.$langs->trans("Ref").''.$object->ref.'
'.$langs->trans("Amount").''.price($object->amount).'
'.$langs->trans("File").''; - - $relativepath = 'bon/'.$object->ref; - - print ''.$object->ref.''; - - print '

'; - - $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 ''.$langs->trans("ErrorNoImagickReadimage").''; - } - } - - if (file_exists($fileimage)) - { - print ''; - - } - - 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 87bab387344..66a1c81e8e9 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 27ae87ca3b4..d0b467f294b 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 c99744f7430..364e073676b 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 b3f9acb3570..f1617979645 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 ''.$lipre->bon_ref.''; print ''.$langs->trans("Date").''.dol_print_date($bon->datec,'day').''; print ''.$langs->trans("Amount").''.price($lipre->amount).''; - print ''.$langs->trans("Status").''; - - print $lipre->LibStatut($lipre->statut,1).''; + print ''.$langs->trans("Status").''.$lipre->LibStatut($lipre->statut,1).''; if ($lipre->statut == 3) { @@ -215,7 +216,7 @@ if ($id) print '
'; //Confirm Button - print '
'; + print '
'; print ''; } @@ -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 "id\">".$langs->trans("StandingOrderReject").""; + if ($user->rights->prelevement->bons->credit) + { + print "id\">".$langs->trans("StandingOrderReject").""; + } + else + { + print "trans("NotAllowed")."\">".$langs->trans("StandingOrderReject").""; + } } else { - print "".$langs->trans("StandingOrderReject").""; + print "trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject").""; } } @@ -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\n"; print ''; print ''; - print ''; + print ''; print ''; $var=True; @@ -312,6 +320,11 @@ if ($id) print '\n"; + print '\n"; + print "\n"; $i++; diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index 257f13558ee..53f54d66f70 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 dccee9d0c8e..35cfa23d9e2 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.
'.$langs->trans("Invoice").''.$langs->trans("ThirdParty").''.$langs->trans("Amount").''.$langs->trans("Invoice").''.$langs->trans("ThirdParty").''.$langs->trans("Amount").''.$langs->trans("Status").'
'.price($obj->total_ttc)."'; + $invoicestatic->fetch($obj->facid); + print $invoicestatic->getLibStatut(5); + print "