diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 5f0dbfd10ac8c6399eb8f6c997789b982ac13cbe..bfda1fb9c1b04bb283e3ea5ede2f1eccf397ff9c 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -287,7 +287,7 @@ print "</table>"; $year = $year_end; -$result=dol_mkdir($conf->banque->dir_temp); +$result=dol_mkdir($conf->bank->dir_temp); if ($result < 0) { $langs->load("errors"); @@ -378,7 +378,7 @@ else } // Fabrication tableau 4b - $file= $conf->banque->dir_temp."/credmovement".$id."-".$year.".png"; + $file= $conf->bank->dir_temp."/credmovement".$id."-".$year.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/credmovement".$id."-".$year.".png"; $title=$langs->transnoentities("Credit").' - '.$langs->transnoentities("Year").': '.($year-2).' - '.($year-1)." - ".$year; $graph_datas=array(); @@ -465,7 +465,7 @@ else $datamin[$i] = 0; } - $file= $conf->banque->dir_temp."/debmovement".$id."-".$year.".png"; + $file= $conf->bank->dir_temp."/debmovement".$id."-".$year.".png"; $fileurl= DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/debmovement".$id."-".$year.".png"; $title=$langs->transnoentities("Debit").' - '.$langs->transnoentities("Year").': '.($year-2).' - '.($year-1)." - ".$year; $graph_datas=array(); diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 6f9de0a5aac47b75ab49e78d999dac69c8853038..66aff20f40c4583d425339c56e8b6e35c692a7da 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -78,7 +78,7 @@ if ($_GET["ref"]) $account=$acct->id; } -$result=dol_mkdir($conf->banque->dir_temp); +$result=dol_mkdir($conf->bank->dir_temp); if ($result < 0) { $langs->load("errors"); @@ -223,7 +223,7 @@ else //exit; // Fabrication tableau 1 - $file= $conf->banque->dir_temp."/balance".$account."-".$year.$month.".png"; + $file= $conf->bank->dir_temp."/balance".$account."-".$year.$month.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.$month.".png"; $title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); @@ -360,7 +360,7 @@ else } // Fabrication tableau 2 - $file= $conf->banque->dir_temp."/balance".$account."-".$year.".png"; + $file= $conf->bank->dir_temp."/balance".$account."-".$year.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.".png"; $title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); @@ -475,7 +475,7 @@ else } // Fabrication tableau 3 - $file= $conf->banque->dir_temp."/balance".$account.".png"; + $file= $conf->bank->dir_temp."/balance".$account.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account.".png"; $title=$langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime"); $graph_datas=array(); @@ -609,7 +609,7 @@ else } // Fabrication tableau 4a - $file= $conf->banque->dir_temp."/movement".$account."-".$year.$month.".png"; + $file= $conf->bank->dir_temp."/movement".$account."-".$year.$month.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.$month.".png"; $title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); @@ -718,7 +718,7 @@ else } // Fabrication tableau 4b - $file= $conf->banque->dir_temp."/movement".$account."-".$year.".png"; + $file= $conf->bank->dir_temp."/movement".$account."-".$year.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.".png"; $title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 0bd855b928a9decc6482ef65c5e2f5e752b86270..46e4bffacfb0a96c28e7f5d73622177d663b4179 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -46,7 +46,7 @@ $optioncss = GETPOST('optioncss','alpha'); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque'); -$diroutputmassaction=$conf->banque->dir_output . '/temp/massgeneration/'.$user->id; +$diroutputmassaction=$conf->bank->dir_output . '/temp/massgeneration/'.$user->id; $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index 5c1e3446e8d92fc01dc1c80a5672e00221e594d7..b0447db68c2a920bdc31680e3cce0b919b96baf2 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -139,7 +139,7 @@ if (empty($reshook)) $objectlabel='BankTransaction'; $permtoread = $user->rights->banque->lire; $permtodelete = $user->rights->banque->supprimer; - $uploaddir = $conf->banque->dir_output; + $uploaddir = $conf->bank->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 8d43e5736965256b709764c4d35fb21b28940d7a..3ca8eb21e6e61924007784e05d4379b3caac32e7 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -57,7 +57,7 @@ if ($page < 0) { $page = 0 ; } $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; -$dir=$conf->banque->dir_output.'/bordereau/'; +$dir=$conf->bank->dir_output.'/checkdeposits/'; $filterdate=dol_mktime(0, 0, 0, GETPOST('fdmonth'), GETPOST('fdday'), GETPOST('fdyear')); $filteraccountid=GETPOST('accountid'); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 6ab43a277c05db83f0f2712c2fedb0582bd630d2..998fd1db7c33cb2aad395c8eb95f1d385153d2e6 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -597,7 +597,7 @@ class RemiseCheque extends CommonObject // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charseSupprimert_output=$outputlangs->charset_output; - $result=$docmodel->write_file($this, $conf->banque->dir_output.'/bordereau', $this->ref, $outputlangs); + $result=$docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs); if ($result > 0) { //$outputlangs->charset_output=$sav_charset_output; diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 2e5d7d71252e6784e9705772e2dbcbbd63553701..17daf01d96caaafc571305896f22bbc1daa6ac2a 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -24,10 +24,10 @@ // $action must be defined // $id must be defined -// $object must be defined and must have a method generateDocument. +// $object must be defined and must have a method generateDocument(). // $permissioncreate must be defined // $upload_dir must be defined (example $conf->projet->dir_output . "/";) -// $hidedetails, $hidedesc and $hideref may have been set or not. +// $hidedetails, $hidedesc, $hideref and $moreparams may have been set or not. // Build doc @@ -63,6 +63,7 @@ if ($action == 'builddoc' && $permissioncreate) $outputlangs = $langs; $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->thirdparty->default_lang)) $newlang=$object->thirdparty->default_lang; // for proposal, order, invoice, ... if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->default_lang)) $newlang=$object->default_lang; // for thirdparty @@ -76,8 +77,9 @@ if ($action == 'builddoc' && $permissioncreate) if (empty($hidedetails)) $hidedetails=0; if (empty($hidedesc)) $hidedesc=0; if (empty($hideref)) $hideref=0; + if (empty($moreparams)) $moreparams=null; - $result= $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result= $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); if ($result <= 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c96eb2124f63821c40ff4c55941bbb66a85a48f5..a82a4c9e5376cc9dfab4655e692b3d84ab27fd72 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3807,9 +3807,10 @@ abstract class CommonObject * @param int $hidedetails 1 to hide details. 0 by default * @param int $hidedesc 1 to hide product description. 0 by default * @param int $hideref 1 to hide product reference. 0 by default + * @param null|array $moreparams Array to provide more information * @return int >0 if OK, <0 if KO */ - protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref) + protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null) { global $conf, $langs; @@ -3914,14 +3915,14 @@ abstract class CommonObject // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output=$outputlangs->charset_output; - + if (in_array(get_class($this), array('Adherent'))) { - $arrayofrecords = array(); - $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1); + $arrayofrecords = array(); // The write_file of templates of adherent class need this + $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams); } - else $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref); - + else $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); + if ($resultwritefile > 0) { $outputlangs->charset_output=$sav_charset_output; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index ba60121969b2ab027d0371492f833d7ebe96b31a..cdb9cf3a91109e96cc899d3ec5f3f7b5bdc53542 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1779,7 +1779,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $accessallowed=1; } - $original_file=$conf->banque->dir_output.'/bordereau/'.$original_file; // original_file should contains relative path so include the get_exdir result + $original_file=$conf->bank->dir_output.'/checkdeposits/'.$original_file; // original_file should contains relative path so include the get_exdir result } // Wrapping for bank diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 820d9bec2f30f1d773fae685792dd4e05a1ca18c..3340836c9f5de44add02fe9b511962cb0917358e 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -88,11 +88,16 @@ class pdf_sepamandate extends ModeleBankAccountDoc /** * Fonction generant le projet sur le disque * - * @param Project $object Object project a generer - * @param Translate $outputlangs Lang output object - * @return int 1 if OK, <=0 if KO + * @param Project $object Object project a generer + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details (not used for this template) + * @param int $hidedesc Do not show desc (not used for this template) + * @param int $hideref Do not show ref (not used for this template) + * @param null|array $moreparams More parameters + * @return int 1 if OK, <=0 if KO */ - function write_file($object,$outputlangs) + function write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf, $hookmanager, $langs, $user, $mysoc; @@ -104,22 +109,26 @@ class pdf_sepamandate extends ModeleBankAccountDoc $outputlangs->load("dict"); $outputlangs->load("companies"); $outputlangs->load("projects"); - - if ($conf->bank->dir_output) + $outputlangs->load("withdrawals"); + $outputlangs->load("bills"); + + if (! empty($conf->bank->dir_output)) { //$nblignes = count($object->lines); // This is set later with array of tasks // Definition of $dir and $file if ($object->specimen) { - $dir = $conf->bank->dir_output; + if (! empty($moreparams['force_dir_output'])) $dir = $moreparams['force_dir_output']; + else $dir = $conf->bank->dir_output; $file = $dir . "/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->bank->dir_output . "/" . $objectref; - $file = $dir . "/" . $objectref . ".pdf"; + if (! empty($moreparams['force_dir_output'])) $dir = $moreparams['force_dir_output']; + else $dir = $conf->bank->dir_output . "/" . $objectref; + $file = $dir . "/" . $langs->trans("SepaMandateShort").' '.$objectref . "-".dol_sanitizeFileName($object->rum).".pdf"; } if (! file_exists($dir)) @@ -264,7 +273,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $sepaname = '______________________________________________'; if ($thirdparty->id > 0) { - $sepaname = $thirdparty->name.' ('.$object->account_owner.')'; + $sepaname = $thirdparty->name.($object->account_owner?' ('.$object->account_owner.')':''); } $posY=$pdf->GetY(); $posY+=3; @@ -354,11 +363,11 @@ class pdf_sepamandate extends ModeleBankAccountDoc $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - var_dump($tab_top); + /*var_dump($tab_top); var_dump($heightforinfotot); var_dump($heightforfreetext); var_dump($heightforfooter); - var_dump($bottomlasttab); + var_dump($bottomlasttab);*/ // Affiche zone infos $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); @@ -555,6 +564,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc { $daterum = dol_print_date($object->date_rum,'day',false,$outputlangs,true); } + else $daterum = dol_print_date($object->datec,'day',false,$outputlangs,true); // For old record, the date_rum was not saved. $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . $daterum, '', 'R'); /*$posy+=6; $pdf->SetXY($posx,$posy); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 1c752afcae09c11c383b742a52ab1c9c27e08bee..ea330faef1a52de603126fd951d0f583de50fc3c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -149,7 +149,7 @@ class pdf_einstein extends ModelePDFCommandes * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @return int 1=OK, 0=KO */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { diff --git a/htdocs/install/mysql/tables/llx_societe_rib.key.sql b/htdocs/install/mysql/tables/llx_societe_rib.key.sql new file mode 100644 index 0000000000000000000000000000000000000000..2c4511b1a5aab989b1113b539ea8ab039d6a302d --- /dev/null +++ b/htdocs/install/mysql/tables/llx_societe_rib.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> +-- +-- 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/>. +-- +-- =================================================================== + + +ALTER TABLE llx_societe_rib ADD UNIQUE INDEX uk_societe_rib(label, fk_soc); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 8db34216f181f8136b730e0e61ff2b03cd9ab60d..1efe7ffd5046659eaf62c9247a4253136e77ee08 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -453,9 +453,12 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) // Actions for all version (not in database) - migrate_delete_old_files($db,$langs,$conf); + migrate_delete_old_files($db, $langs, $conf); - migrate_delete_old_dir($db,$langs,$conf); + migrate_delete_old_dir($db, $langs, $conf); + + dol_mkdir(DOL_DATA_ROOT.'/bank'); + migrate_directories($db, $langs, $conf, '/banque/bordereau', '/bank/checkdeposits'); } print '</table>'; @@ -3866,8 +3869,8 @@ function migrate_remise_except_entity($db,$langs,$conf) * @param DoliDB $db Database handler * @param Translate $langs Object langs * @param Conf $conf Object conf - * @param string $oldname Old name - * @param string $newname New name + * @param string $oldname Old name (relative to DOL_DATA_ROOT) + * @param string $newname New name (relative to DOL_DATA_ROOT) * @return void */ function migrate_directories($db,$langs,$conf,$oldname,$newname) diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 5030ebffaac6edb8840e2d993f45ecbade4c4c4b..d997c8fd35f2dbc2c9925fa93f66d1e788c25333 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -79,6 +79,7 @@ WithdrawMode=Direct debit mode (FRST or RECUR) WithdrawRequestAmount=Withdraw request amount: WithdrawRequestErrorNilAmount=Unable to create withdraw request for nil amount. SepaMandate=SEPA Direct Debit Mandate +SepaMandateShort=SEPA Mandate PleaseReturnMandate=Please return this mandate form to SEPALegalText=By signing this mandate form, you authorize (A) %s to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with the instructions from %s. As part of your rights, you are entitled to a refund from your bank under the terms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited. Your rights regarding the above mandate are explained in a statement that you can obtain from your bank. CreditorIdentifier=Creditor Identifier diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index f7bad84370950a204aec4d8d1f43683a75d27a70..68749713788fa9e3f114c7ba5edec4fd4d6d2fdc 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -176,6 +176,8 @@ class CompanyBankAccount extends Account { $obj = $this->db->fetch_object($resql); + $this->ref = $obj->fk_soc.'-'.$obj->label; // Generate an artificial ref + $this->id = $obj->rowid; $this->socid = $obj->fk_soc; $this->bank = $obj->bank; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 88bc3ff216d2da65a8eccd71d5675063c3e7758c..ee60baaa39517e9aa43885956074a19be92b6965 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3408,29 +3408,43 @@ class Societe extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int <0 if KO, >0 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$user,$langs; - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) + if (! empty($moreparams) && ! empty($moreparams['use_companybankid'])) { - if (! empty($conf->global->COMPANY_ADDON_PDF)) - { - $modele = $conf->global->COMPANY_ADDON_PDF; - } - else - { - print $langs->trans("Error")." ".$langs->trans("Error_COMPANY_ADDON_PDF_NotDefined"); - return 0; - } - } - - $modelpath = "core/modules/societe/doc/"; + $modelpath = "core/modules/bank/doc/"; - $result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + include_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; + $companybankaccount = new CompanyBankAccount($this->db); + $result = $companybankaccount->fetch($moreparams['use_companybankid']); + if (! $result) dol_print_error($this->db, $companybankaccount->error, $companybankaccount->errors); + $result=$companybankaccount->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + } + else + { + // Positionne le modele sur le nom du modele a utiliser + if (! dol_strlen($modele)) + { + if (! empty($conf->global->COMPANY_ADDON_PDF)) + { + $modele = $conf->global->COMPANY_ADDON_PDF; + } + else + { + print $langs->trans("Error")." ".$langs->trans("Error_COMPANY_ADDON_PDF_NotDefined"); + return 0; + } + } + + $modelpath = "core/modules/societe/doc/"; + + $result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + } return $result; } diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 5c989720f1c8ace679c9a40d8dd551ccf3fba5e4..4826eb5ff2b65935012dbe4bb39fb7f3438804ce 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -281,13 +281,22 @@ if (empty($reshook)) } $savid=$id; - + // Actions to build doc + if ($action == 'builddocrib') + { + $action = 'builddoc'; + $moreparams = array( + 'use_companybankid'=>GETPOST('companybankid'), + 'force_dir_output'=>$conf->societe->dir_output.'/'.dol_sanitizeFileName($object->id) + ); + $_POST['lang_id'] = GETPOST('lang_idrib'.GETPOST('companybankid')); + } $id = $socid; $upload_dir = $conf->societe->dir_output; $permissioncreate=$user->rights->societe->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - + $id = $savid; } @@ -435,10 +444,11 @@ if ($socid && $action != 'edit' && $action != "create") print_liste_field_titre($langs->trans("BIC")); if (! empty($conf->prelevement->enabled)) { - print '<td>'.$langs->trans("RUM").'</td>'; - print '<td>'.$langs->trans("WithdrawMode").'</td>'; + print print_liste_field_titre($langs->trans("RUM")); + print print_liste_field_titre($langs->trans("WithdrawMode")); } print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"'); + print_liste_field_titre('', '', '', '', '', 'align="center"'); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "</tr>\n"; @@ -512,7 +522,60 @@ if ($socid && $action != 'edit' && $action != "create") print img_picto($langs->trans("Enabled"),'on'); } print '</td>'; - + + // Generate doc + print '<td align="center">'; + + $buttonlabel = $langs->trans("BuildDoc"); + $forname='builddocrib'.$rib->id; + + include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php'; + $modellist=ModeleBankAccountDoc::liste_modeles($db); + $out = ''; + if (is_array($modellist) && count($modellist)) + { + $out.= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">'; + $out.= '<input type="hidden" name="action" value="builddocrib">'; + $out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; + $out.= '<input type="hidden" name="socid" value="'.$object->id.'">'; + $out.= '<input type="hidden" name="companybankid" value="'.$rib->id.'">'; + + if (is_array($modellist) && count($modellist) == 1) // If there is only one element + { + $arraykeys=array_keys($modellist); + $modelselected=$arraykeys[0]; + } + $out.= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100'); + $out.= ajax_combobox('modelrib'.$rib->id); + + // Language code (if multilang) + if ($conf->global->MAIN_MULTILANGS) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + $formadmin=new FormAdmin($db); + $defaultlang=$codelang?$codelang:$langs->getDefaultLang(); + $morecss='maxwidth150'; + if (! empty($conf->browser->phone)) $morecss='maxwidth100'; + $out.= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss); + } + // Button + $genbutton = '<input class="button buttongen" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"'; + $genbutton.= ' type="submit" value="'.$buttonlabel.'"'; + if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) $genbutton.= ' disabled'; + $genbutton.= '>'; + if ($allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') + { + $langs->load("errors"); + $genbutton.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated")); + } + if (! $allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') $genbutton=''; + if (empty($modellist) && ! $showempty && $modulepart != 'unpaid') $genbutton=''; + $out.= $genbutton; + $out.= '</form>'; + } + print $out; + print '</td>'; + // Edit/Delete print '<td align="right">'; if ($user->rights->societe->creer) @@ -534,7 +597,7 @@ if ($socid && $action != 'edit' && $action != "create") if (count($rib_list) == 0) { - $colspan=7; + $colspan=8; if (! empty($conf->prelevement->enabled)) $colspan+=2; print '<tr '.$bc[0].'><td colspan="'.$colspan.'" align="center">'.$langs->trans("NoBANRecord").'</td></tr>'; } diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index 4ec31ea37895f0b49c7adaad7162c8d7ee8c32c4..2116d51e65b2f253a7c8b2e784dc3daa175843ec 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -143,7 +143,7 @@ $objmodel = new $classname($db); // Define target path -$dirname = $conf->banque->dir_temp; +$dirname = $conf->bank->dir_temp; $filename = 'export-bank-receipts-'.$bankref.'-'.$num.'.'.$objmodel->extension;