Fix: Bank receipt translation and fix
This commit is contained in:
parent
b4f34aa195
commit
58e4844795
@ -104,7 +104,7 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user-
|
|||||||
if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->banque)
|
if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->banque)
|
||||||
{
|
{
|
||||||
$remisecheque = new RemiseCheque($db);
|
$remisecheque = new RemiseCheque($db);
|
||||||
$remisecheque->Fetch($_GET["id"]);
|
$result = $remisecheque->Fetch($_GET["id"]);
|
||||||
$result = $remisecheque->Validate($user);
|
$result = $remisecheque->Validate($user);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
@ -121,15 +121,29 @@ if ($_POST['action'] == 'builddoc' && $user->rights->banque)
|
|||||||
{
|
{
|
||||||
$remisecheque = new RemiseCheque($db);
|
$remisecheque = new RemiseCheque($db);
|
||||||
$result = $remisecheque->Fetch($_GET["id"]);
|
$result = $remisecheque->Fetch($_GET["id"]);
|
||||||
if ($result == 0)
|
|
||||||
|
/*if ($_REQUEST['model'])
|
||||||
{
|
{
|
||||||
$result = $remisecheque->GeneratePdf($_POST["model"], $langs);
|
$remisecheque->setDocModel($user, $_REQUEST['model']);
|
||||||
Header("Location: fiche.php?id=".$remisecheque->id);
|
}*/
|
||||||
|
|
||||||
|
$outputlangs = $langs;
|
||||||
|
if (! empty($_REQUEST['lang_id']))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $remisecheque->GeneratePdf($_POST["model"], $outputlangs);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db,$result);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$remisecheque->id.'#builddoc');
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,7 +345,7 @@ else
|
|||||||
$sql.= " WHERE b.fk_type= 'CHQ'";
|
$sql.= " WHERE b.fk_type= 'CHQ'";
|
||||||
$sql.= " AND b.fk_bordereau = ".$remisecheque->id;
|
$sql.= " AND b.fk_bordereau = ".$remisecheque->id;
|
||||||
$sql.= " ORDER BY $sortfield $sortorder";
|
$sql.= " ORDER BY $sortfield $sortorder";
|
||||||
|
//print $sql;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -398,15 +412,6 @@ else
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
if ($_GET['action'] != 'new')
|
|
||||||
{
|
|
||||||
if ($remisecheque->statut == 1)
|
|
||||||
{
|
|
||||||
$dir = DOL_DATA_ROOT.'/compta/bordereau/'.get_exdir($remisecheque->number);
|
|
||||||
$gen = array('Blochet');
|
|
||||||
$formfile->show_documents("remisecheque","",$dir,'',$gen,0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boutons Actions
|
* Boutons Actions
|
||||||
@ -432,6 +437,18 @@ if ($user->societe_id == 0 && $_GET['action'] == '')
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($_GET['action'] != 'new')
|
||||||
|
{
|
||||||
|
if ($remisecheque->statut == 1)
|
||||||
|
{
|
||||||
|
$dir = DOL_DATA_ROOT.'/compta/bordereau/'.get_exdir($remisecheque->number);
|
||||||
|
$gen = array('Blochet');
|
||||||
|
$formfile->show_documents("remisecheque","",$dir,$_SERVER["PHP_SELF"].'?id='.$remisecheque->id,$gen,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
llxFooter('$Date$ - $Revision$');
|
||||||
|
|||||||
@ -57,9 +57,10 @@ class RemiseCheque extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Load record
|
* \brief Load record
|
||||||
\param id Id record
|
* \param id Id record
|
||||||
\param ref Ref record
|
* \param ref Ref record
|
||||||
|
* \return int <0 if KO, >= 0 if OK
|
||||||
*/
|
*/
|
||||||
function Fetch($id,$ref='')
|
function Fetch($id,$ref='')
|
||||||
{
|
{
|
||||||
@ -108,10 +109,10 @@ class RemiseCheque extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Create a receipt to send cheques
|
* \brief Create a receipt to send cheques
|
||||||
\param user Utilisateur qui effectue l'operation
|
* \param user Utilisateur qui effectue l'operation
|
||||||
\param account_id Compte bancaire concerne
|
* \param account_id Compte bancaire concerne
|
||||||
\return int <0 if KO, >0 if OK
|
* \return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function Create($user, $account_id)
|
function Create($user, $account_id)
|
||||||
{
|
{
|
||||||
@ -206,6 +207,7 @@ class RemiseCheque extends CommonObject
|
|||||||
{
|
{
|
||||||
$result = -1;
|
$result = -1;
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
|
$this->errno=$this->db->lasterrno();
|
||||||
dolibarr_syslog("RemiseCheque::Create Erreur $result INSERT Mysql");
|
dolibarr_syslog("RemiseCheque::Create Erreur $result INSERT Mysql");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +288,7 @@ class RemiseCheque extends CommonObject
|
|||||||
|
|
||||||
$num=$this->getNextNumber();
|
$num=$this->getNextNumber();
|
||||||
|
|
||||||
if ($this->errno == 0)
|
if ($this->errno == 0 && $num)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||||
$sql.= " SET statut=1, number='".$num."'";
|
$sql.= " SET statut=1, number='".$num."'";
|
||||||
@ -305,19 +307,19 @@ class RemiseCheque extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->errno = -1029;
|
$this->errno = -1029;
|
||||||
dolibarr_syslog("Remisecheque::Validate Erreur UPDATE ($this->errno)");
|
dolibarr_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->errno = -1033;
|
$this->errno = -1033;
|
||||||
dolibarr_syslog("Remisecheque::Validate Erreur UPDATE ($this->errno)");
|
dolibarr_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->errno == 0)
|
if ($this->errno == 0)
|
||||||
{
|
{
|
||||||
$this->GeneratePdf();
|
$result=$this->GeneratePdf();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit/Rollback
|
// Commit/Rollback
|
||||||
@ -412,8 +414,6 @@ class RemiseCheque extends CommonObject
|
|||||||
require_once(DOL_DOCUMENT_ROOT ."/compta/bank/account.class.php");
|
require_once(DOL_DOCUMENT_ROOT ."/compta/bank/account.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/cheque/pdf/pdf_".$model.".class.php");
|
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/cheque/pdf/pdf_".$model.".class.php");
|
||||||
|
|
||||||
$result = $this->Fetch($this->id);
|
|
||||||
|
|
||||||
$class='BordereauCheque'.ucfirst($model);
|
$class='BordereauCheque'.ucfirst($model);
|
||||||
$pdf = new $class($db);
|
$pdf = new $class($db);
|
||||||
|
|
||||||
@ -424,8 +424,8 @@ class RemiseCheque extends CommonObject
|
|||||||
$sql.= " AND bc.rowid = ".$this->id;
|
$sql.= " AND bc.rowid = ".$this->id;
|
||||||
$sql.= " ORDER BY b.emetteur ASC, b.rowid ASC;";
|
$sql.= " ORDER BY b.emetteur ASC, b.rowid ASC;";
|
||||||
|
|
||||||
|
dolibarr_syslog("RemiseCheque::GeneratePdf sql=".$sql, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -451,7 +451,8 @@ 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_charset_output=$outputlangs->charset_output;
|
$sav_charset_output=$outputlangs->charset_output;
|
||||||
if ($pdf->write_file(DOL_DATA_ROOT.'/compta/bordereau', $this->number, $outputlangs) > 0)
|
$result=$pdf->write_file(DOL_DATA_ROOT.'/compta/bordereau', $this->number, $outputlangs);
|
||||||
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
$outputlangs->charset_output=$sav_charset_output;
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -118,9 +118,9 @@ class FormFile
|
|||||||
/**
|
/**
|
||||||
* \brief Affiche la cartouche de la liste des documents d'une propale, facture...
|
* \brief Affiche la cartouche de la liste des documents d'une propale, facture...
|
||||||
* \param modulepart propal=propal, facture=facture, ...
|
* \param modulepart propal=propal, facture=facture, ...
|
||||||
* \param filename Sous rep <EFBFBD> scanner (vide si filedir deja complet)
|
* \param filename Sub dir to scan (vide si filedir deja complet)
|
||||||
* \param filedir Repertoire <EFBFBD> scanner
|
* \param filedir Dir to scan
|
||||||
* \param urlsource Url page origine (pour retour)
|
* \param urlsource Url of origin page (for return)
|
||||||
* \param genallowed G<EFBFBD>n<EFBFBD>ration autoris<EFBFBD>e (1/0 ou array des formats)
|
* \param genallowed G<EFBFBD>n<EFBFBD>ration autoris<EFBFBD>e (1/0 ou array des formats)
|
||||||
* \param delallowed Suppression autoris<EFBFBD>e (1/0)
|
* \param delallowed Suppression autoris<EFBFBD>e (1/0)
|
||||||
* \param modelselected Modele <EFBFBD> pr<EFBFBD>-s<EFBFBD>lectionner par d<EFBFBD>faut
|
* \param modelselected Modele <EFBFBD> pr<EFBFBD>-s<EFBFBD>lectionner par d<EFBFBD>faut
|
||||||
|
|||||||
@ -64,6 +64,11 @@ class BordereauChequeBlochet extends FPDF
|
|||||||
$this->marge_haute=10;
|
$this->marge_haute=10;
|
||||||
$this->marge_basse=10;
|
$this->marge_basse=10;
|
||||||
|
|
||||||
|
// Recupere emmetteur
|
||||||
|
$this->emetteur=$mysoc;
|
||||||
|
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
|
||||||
|
|
||||||
|
// Defini position des colonnes
|
||||||
$this->line_height = 5;
|
$this->line_height = 5;
|
||||||
$this->line_per_page = 25;
|
$this->line_per_page = 25;
|
||||||
$this->tab_height = 200; //$this->line_height * $this->line_per_page;
|
$this->tab_height = 200; //$this->line_height * $this->line_per_page;
|
||||||
@ -74,10 +79,11 @@ class BordereauChequeBlochet extends FPDF
|
|||||||
* \param _dir Directory
|
* \param _dir Directory
|
||||||
* \param number Number
|
* \param number Number
|
||||||
* \param outputlangs Lang output object
|
* \param outputlangs Lang output object
|
||||||
|
* \return int 1=ok, 0=ko
|
||||||
*/
|
*/
|
||||||
function write_file($_dir, $number, $outputlangs)
|
function write_file($_dir, $number, $outputlangs)
|
||||||
{
|
{
|
||||||
global $user,$conf,$langs,$mysoc;
|
global $user,$conf,$langs;
|
||||||
|
|
||||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||||
@ -148,6 +154,9 @@ class BordereauChequeBlochet extends FPDF
|
|||||||
$pdf->Output($_file);
|
$pdf->Output($_file);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
|
$langs->setPhpLang(); // On restaure langue session
|
||||||
|
return 1; // Pas d'erreur
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -160,15 +169,18 @@ class BordereauChequeBlochet extends FPDF
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Generate Header
|
* \brief Generate Header
|
||||||
\param pdf pdf object
|
* \param pdf pdf object
|
||||||
\param page current page number
|
* \param page current page number
|
||||||
\param pages number of pages
|
* \param pages number of pages
|
||||||
*/
|
*/
|
||||||
function Header(&$pdf, $page, $pages, $outputlangs)
|
function Header(&$pdf, $page, $pages, $outputlangs)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
|
$outputlangs->load("compta");
|
||||||
|
$outputlangs->load("banks");
|
||||||
|
|
||||||
$title = $outputlangs->transnoentities("CheckReceipt");
|
$title = $outputlangs->transnoentities("CheckReceipt");
|
||||||
$pdf->SetFont('Arial','B',10);
|
$pdf->SetFont('Arial','B',10);
|
||||||
$pdf->Text(10, 10, $title);
|
$pdf->Text(10, 10, $title);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user