NEW Can generate SEPA mandate for each bank account of your customers
This commit is contained in:
parent
35e568f715
commit
db3e3642b0
@ -287,7 +287,7 @@ print "</table>";
|
|||||||
|
|
||||||
$year = $year_end;
|
$year = $year_end;
|
||||||
|
|
||||||
$result=dol_mkdir($conf->banque->dir_temp);
|
$result=dol_mkdir($conf->bank->dir_temp);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
@ -378,7 +378,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fabrication tableau 4b
|
// 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";
|
$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;
|
$title=$langs->transnoentities("Credit").' - '.$langs->transnoentities("Year").': '.($year-2).' - '.($year-1)." - ".$year;
|
||||||
$graph_datas=array();
|
$graph_datas=array();
|
||||||
@ -465,7 +465,7 @@ else
|
|||||||
$datamin[$i] = 0;
|
$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";
|
$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;
|
$title=$langs->transnoentities("Debit").' - '.$langs->transnoentities("Year").': '.($year-2).' - '.($year-1)." - ".$year;
|
||||||
$graph_datas=array();
|
$graph_datas=array();
|
||||||
|
|||||||
@ -78,7 +78,7 @@ if ($_GET["ref"])
|
|||||||
$account=$acct->id;
|
$account=$acct->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=dol_mkdir($conf->banque->dir_temp);
|
$result=dol_mkdir($conf->bank->dir_temp);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
@ -223,7 +223,7 @@ else
|
|||||||
//exit;
|
//exit;
|
||||||
|
|
||||||
// Fabrication tableau 1
|
// 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";
|
$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;
|
$title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
|
||||||
$graph_datas=array();
|
$graph_datas=array();
|
||||||
@ -360,7 +360,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fabrication tableau 2
|
// 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";
|
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.".png";
|
||||||
$title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Year").': '.$year;
|
$title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Year").': '.$year;
|
||||||
$graph_datas=array();
|
$graph_datas=array();
|
||||||
@ -475,7 +475,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fabrication tableau 3
|
// 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";
|
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account.".png";
|
||||||
$title=$langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime");
|
$title=$langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime");
|
||||||
$graph_datas=array();
|
$graph_datas=array();
|
||||||
@ -609,7 +609,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fabrication tableau 4a
|
// 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";
|
$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;
|
$title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
|
||||||
$graph_datas=array();
|
$graph_datas=array();
|
||||||
@ -718,7 +718,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fabrication tableau 4b
|
// 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";
|
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.".png";
|
||||||
$title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Year").': '.$year;
|
$title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Year").': '.$year;
|
||||||
$graph_datas=array();
|
$graph_datas=array();
|
||||||
|
|||||||
@ -46,7 +46,7 @@ $optioncss = GETPOST('optioncss','alpha');
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result=restrictedArea($user,'banque');
|
$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;
|
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
|
|||||||
@ -139,7 +139,7 @@ if (empty($reshook))
|
|||||||
$objectlabel='BankTransaction';
|
$objectlabel='BankTransaction';
|
||||||
$permtoread = $user->rights->banque->lire;
|
$permtoread = $user->rights->banque->lire;
|
||||||
$permtodelete = $user->rights->banque->supprimer;
|
$permtodelete = $user->rights->banque->supprimer;
|
||||||
$uploaddir = $conf->banque->dir_output;
|
$uploaddir = $conf->bank->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ if ($page < 0) { $page = 0 ; }
|
|||||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$offset = $limit * $page ;
|
$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'));
|
$filterdate=dol_mktime(0, 0, 0, GETPOST('fdmonth'), GETPOST('fdday'), GETPOST('fdyear'));
|
||||||
$filteraccountid=GETPOST('accountid');
|
$filteraccountid=GETPOST('accountid');
|
||||||
|
|
||||||
|
|||||||
@ -597,7 +597,7 @@ class RemiseCheque extends CommonObject
|
|||||||
// We save charset_output to restore it because write_file can change it if needed for
|
// We save charset_output to restore it because write_file can change it if needed for
|
||||||
// output format that does not support UTF8.
|
// output format that does not support UTF8.
|
||||||
$sav_charseSupprimert_output=$outputlangs->charset_output;
|
$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)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
//$outputlangs->charset_output=$sav_charset_output;
|
//$outputlangs->charset_output=$sav_charset_output;
|
||||||
|
|||||||
@ -24,10 +24,10 @@
|
|||||||
|
|
||||||
// $action must be defined
|
// $action must be defined
|
||||||
// $id 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
|
// $permissioncreate must be defined
|
||||||
// $upload_dir must be defined (example $conf->projet->dir_output . "/";)
|
// $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
|
// Build doc
|
||||||
@ -63,6 +63,7 @@ if ($action == 'builddoc' && $permissioncreate)
|
|||||||
|
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang='';
|
$newlang='';
|
||||||
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
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->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
|
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($hidedetails)) $hidedetails=0;
|
||||||
if (empty($hidedesc)) $hidedesc=0;
|
if (empty($hidedesc)) $hidedesc=0;
|
||||||
if (empty($hideref)) $hideref=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)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
|||||||
@ -3807,9 +3807,10 @@ abstract class CommonObject
|
|||||||
* @param int $hidedetails 1 to hide details. 0 by default
|
* @param int $hidedetails 1 to hide details. 0 by default
|
||||||
* @param int $hidedesc 1 to hide product description. 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 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
|
* @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;
|
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
|
// We save charset_output to restore it because write_file can change it if needed for
|
||||||
// output format that does not support UTF8.
|
// output format that does not support UTF8.
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
$sav_charset_output=$outputlangs->charset_output;
|
||||||
|
|
||||||
if (in_array(get_class($this), array('Adherent')))
|
if (in_array(get_class($this), array('Adherent')))
|
||||||
{
|
{
|
||||||
$arrayofrecords = array();
|
$arrayofrecords = array(); // The write_file of templates of adherent class need this
|
||||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1);
|
$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)
|
if ($resultwritefile > 0)
|
||||||
{
|
{
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
$outputlangs->charset_output=$sav_charset_output;
|
||||||
|
|||||||
@ -1779,7 +1779,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
|||||||
$accessallowed=1;
|
$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
|
// Wrapping for bank
|
||||||
|
|||||||
@ -88,11 +88,16 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
|||||||
/**
|
/**
|
||||||
* Fonction generant le projet sur le disque
|
* Fonction generant le projet sur le disque
|
||||||
*
|
*
|
||||||
* @param Project $object Object project a generer
|
* @param Project $object Object project a generer
|
||||||
* @param Translate $outputlangs Lang output object
|
* @param Translate $outputlangs Lang output object
|
||||||
* @return int 1 if OK, <=0 if KO
|
* @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;
|
global $conf, $hookmanager, $langs, $user, $mysoc;
|
||||||
|
|
||||||
@ -104,22 +109,26 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
|||||||
$outputlangs->load("dict");
|
$outputlangs->load("dict");
|
||||||
$outputlangs->load("companies");
|
$outputlangs->load("companies");
|
||||||
$outputlangs->load("projects");
|
$outputlangs->load("projects");
|
||||||
|
$outputlangs->load("withdrawals");
|
||||||
if ($conf->bank->dir_output)
|
$outputlangs->load("bills");
|
||||||
|
|
||||||
|
if (! empty($conf->bank->dir_output))
|
||||||
{
|
{
|
||||||
//$nblignes = count($object->lines); // This is set later with array of tasks
|
//$nblignes = count($object->lines); // This is set later with array of tasks
|
||||||
|
|
||||||
// Definition of $dir and $file
|
// Definition of $dir and $file
|
||||||
if ($object->specimen)
|
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";
|
$file = $dir . "/SPECIMEN.pdf";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$objectref = dol_sanitizeFileName($object->ref);
|
$objectref = dol_sanitizeFileName($object->ref);
|
||||||
$dir = $conf->bank->dir_output . "/" . $objectref;
|
if (! empty($moreparams['force_dir_output'])) $dir = $moreparams['force_dir_output'];
|
||||||
$file = $dir . "/" . $objectref . ".pdf";
|
else $dir = $conf->bank->dir_output . "/" . $objectref;
|
||||||
|
$file = $dir . "/" . $langs->trans("SepaMandateShort").' '.$objectref . "-".dol_sanitizeFileName($object->rum).".pdf";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
@ -264,7 +273,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
|||||||
$sepaname = '______________________________________________';
|
$sepaname = '______________________________________________';
|
||||||
if ($thirdparty->id > 0)
|
if ($thirdparty->id > 0)
|
||||||
{
|
{
|
||||||
$sepaname = $thirdparty->name.' ('.$object->account_owner.')';
|
$sepaname = $thirdparty->name.($object->account_owner?' ('.$object->account_owner.')':'');
|
||||||
}
|
}
|
||||||
$posY=$pdf->GetY();
|
$posY=$pdf->GetY();
|
||||||
$posY+=3;
|
$posY+=3;
|
||||||
@ -354,11 +363,11 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
|||||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var_dump($tab_top);
|
/*var_dump($tab_top);
|
||||||
var_dump($heightforinfotot);
|
var_dump($heightforinfotot);
|
||||||
var_dump($heightforfreetext);
|
var_dump($heightforfreetext);
|
||||||
var_dump($heightforfooter);
|
var_dump($heightforfooter);
|
||||||
var_dump($bottomlasttab);
|
var_dump($bottomlasttab);*/
|
||||||
|
|
||||||
// Affiche zone infos
|
// Affiche zone infos
|
||||||
$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
|
$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);
|
$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');
|
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . $daterum, '', 'R');
|
||||||
/*$posy+=6;
|
/*$posy+=6;
|
||||||
$pdf->SetXY($posx,$posy);
|
$pdf->SetXY($posx,$posy);
|
||||||
|
|||||||
@ -149,7 +149,7 @@ class pdf_einstein extends ModelePDFCommandes
|
|||||||
* @param int $hidedetails Do not show line details
|
* @param int $hidedetails Do not show line details
|
||||||
* @param int $hidedesc Do not show desc
|
* @param int $hidedesc Do not show desc
|
||||||
* @param int $hideref Do not show ref
|
* @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)
|
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
|
||||||
{
|
{
|
||||||
|
|||||||
20
htdocs/install/mysql/tables/llx_societe_rib.key.sql
Normal file
20
htdocs/install/mysql/tables/llx_societe_rib.key.sql
Normal file
@ -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);
|
||||||
@ -453,9 +453,12 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
|
|||||||
|
|
||||||
|
|
||||||
// Actions for all version (not in database)
|
// 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>';
|
print '</table>';
|
||||||
@ -3866,8 +3869,8 @@ function migrate_remise_except_entity($db,$langs,$conf)
|
|||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param Translate $langs Object langs
|
* @param Translate $langs Object langs
|
||||||
* @param Conf $conf Object conf
|
* @param Conf $conf Object conf
|
||||||
* @param string $oldname Old name
|
* @param string $oldname Old name (relative to DOL_DATA_ROOT)
|
||||||
* @param string $newname New name
|
* @param string $newname New name (relative to DOL_DATA_ROOT)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function migrate_directories($db,$langs,$conf,$oldname,$newname)
|
function migrate_directories($db,$langs,$conf,$oldname,$newname)
|
||||||
|
|||||||
@ -79,6 +79,7 @@ WithdrawMode=Direct debit mode (FRST or RECUR)
|
|||||||
WithdrawRequestAmount=Withdraw request amount:
|
WithdrawRequestAmount=Withdraw request amount:
|
||||||
WithdrawRequestErrorNilAmount=Unable to create withdraw request for nil amount.
|
WithdrawRequestErrorNilAmount=Unable to create withdraw request for nil amount.
|
||||||
SepaMandate=SEPA Direct Debit Mandate
|
SepaMandate=SEPA Direct Debit Mandate
|
||||||
|
SepaMandateShort=SEPA Mandate
|
||||||
PleaseReturnMandate=Please return this mandate form to
|
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.
|
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
|
CreditorIdentifier=Creditor Identifier
|
||||||
|
|||||||
@ -176,6 +176,8 @@ class CompanyBankAccount extends Account
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
$this->ref = $obj->fk_soc.'-'.$obj->label; // Generate an artificial ref
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->socid = $obj->fk_soc;
|
$this->socid = $obj->fk_soc;
|
||||||
$this->bank = $obj->bank;
|
$this->bank = $obj->bank;
|
||||||
|
|||||||
@ -3408,29 +3408,43 @@ class Societe extends CommonObject
|
|||||||
* @param int $hidedetails Hide details of lines
|
* @param int $hidedetails Hide details of lines
|
||||||
* @param int $hidedesc Hide description
|
* @param int $hidedesc Hide description
|
||||||
* @param int $hideref Hide ref
|
* @param int $hideref Hide ref
|
||||||
|
* @param null|array $moreparams Array to provide more information
|
||||||
* @return int <0 if KO, >0 if OK
|
* @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;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
// Positionne le modele sur le nom du modele a utiliser
|
if (! empty($moreparams) && ! empty($moreparams['use_companybankid']))
|
||||||
if (! dol_strlen($modele))
|
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->COMPANY_ADDON_PDF))
|
$modelpath = "core/modules/bank/doc/";
|
||||||
{
|
|
||||||
$modele = $conf->global->COMPANY_ADDON_PDF;
|
include_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||||
}
|
$companybankaccount = new CompanyBankAccount($this->db);
|
||||||
else
|
$result = $companybankaccount->fetch($moreparams['use_companybankid']);
|
||||||
{
|
if (! $result) dol_print_error($this->db, $companybankaccount->error, $companybankaccount->errors);
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_COMPANY_ADDON_PDF_NotDefined");
|
$result=$companybankaccount->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||||
return 0;
|
}
|
||||||
}
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
$modelpath = "core/modules/societe/doc/";
|
|
||||||
|
|
||||||
$result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -281,13 +281,22 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$savid=$id;
|
$savid=$id;
|
||||||
|
|
||||||
// Actions to build doc
|
// 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;
|
$id = $socid;
|
||||||
$upload_dir = $conf->societe->dir_output;
|
$upload_dir = $conf->societe->dir_output;
|
||||||
$permissioncreate=$user->rights->societe->creer;
|
$permissioncreate=$user->rights->societe->creer;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
$id = $savid;
|
$id = $savid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,10 +444,11 @@ if ($socid && $action != 'edit' && $action != "create")
|
|||||||
print_liste_field_titre($langs->trans("BIC"));
|
print_liste_field_titre($langs->trans("BIC"));
|
||||||
if (! empty($conf->prelevement->enabled))
|
if (! empty($conf->prelevement->enabled))
|
||||||
{
|
{
|
||||||
print '<td>'.$langs->trans("RUM").'</td>';
|
print print_liste_field_titre($langs->trans("RUM"));
|
||||||
print '<td>'.$langs->trans("WithdrawMode").'</td>';
|
print print_liste_field_titre($langs->trans("WithdrawMode"));
|
||||||
}
|
}
|
||||||
print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"');
|
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_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -512,7 +522,60 @@ if ($socid && $action != 'edit' && $action != "create")
|
|||||||
print img_picto($langs->trans("Enabled"),'on');
|
print img_picto($langs->trans("Enabled"),'on');
|
||||||
}
|
}
|
||||||
print '</td>';
|
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
|
// Edit/Delete
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($user->rights->societe->creer)
|
if ($user->rights->societe->creer)
|
||||||
@ -534,7 +597,7 @@ if ($socid && $action != 'edit' && $action != "create")
|
|||||||
|
|
||||||
if (count($rib_list) == 0)
|
if (count($rib_list) == 0)
|
||||||
{
|
{
|
||||||
$colspan=7;
|
$colspan=8;
|
||||||
if (! empty($conf->prelevement->enabled)) $colspan+=2;
|
if (! empty($conf->prelevement->enabled)) $colspan+=2;
|
||||||
print '<tr '.$bc[0].'><td colspan="'.$colspan.'" align="center">'.$langs->trans("NoBANRecord").'</td></tr>';
|
print '<tr '.$bc[0].'><td colspan="'.$colspan.'" align="center">'.$langs->trans("NoBANRecord").'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -143,7 +143,7 @@ $objmodel = new $classname($db);
|
|||||||
|
|
||||||
|
|
||||||
// Define target path
|
// Define target path
|
||||||
$dirname = $conf->banque->dir_temp;
|
$dirname = $conf->bank->dir_temp;
|
||||||
$filename = 'export-bank-receipts-'.$bankref.'-'.$num.'.'.$objmodel->extension;
|
$filename = 'export-bank-receipts-'.$bankref.'-'.$num.'.'.$objmodel->extension;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user