Fix: Bank receipt translation and fix

This commit is contained in:
Laurent Destailleur 2008-12-01 23:09:52 +00:00
parent b4f34aa195
commit 58e4844795
5 changed files with 141 additions and 111 deletions

View File

@ -297,13 +297,13 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
$result = $fac->set_valid($user); $result = $fac->set_valid($user);
if ($result >= 0) if ($result >= 0)
{ {
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($_REQUEST['lang_id'])) if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
} }
else else
{ {
@ -347,13 +347,13 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->modifier && $conf->glo
{ {
$fac->set_draft($user); $fac->set_draft($user);
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($_REQUEST['lang_id'])) if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
} }
} }
@ -838,14 +838,14 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
$date_start=$_POST['date_start'.$suffixe.'year'].'-'.$_POST['date_start'.$suffixe.'month'].'-'.$_POST['date_start'.$suffixe.'day']; $date_start=$_POST['date_start'.$suffixe.'year'].'-'.$_POST['date_start'.$suffixe.'month'].'-'.$_POST['date_start'.$suffixe.'day'];
// If hour/minute are specified, append them // If hour/minute are specified, append them
if (($_POST['date_start'.$suffixe.'hour']) && ($_POST['date_start'.$suffixe.'min'])) if (($_POST['date_start'.$suffixe.'hour']) && ($_POST['date_start'.$suffixe.'min']))
$date_start.=' '.$_POST['date_start'.$suffixe.'hour'].':'.$_POST['date_start'.$suffixe.'min']; $date_start.=' '.$_POST['date_start'.$suffixe.'hour'].':'.$_POST['date_start'.$suffixe.'min'];
} }
if ($_POST['date_end'.$suffixe.'year'] && $_POST['date_end'.$suffixe.'month'] && $_POST['date_end'.$suffixe.'day']) if ($_POST['date_end'.$suffixe.'year'] && $_POST['date_end'.$suffixe.'month'] && $_POST['date_end'.$suffixe.'day'])
{ {
$date_end=$_POST['date_end'.$suffixe.'year'].'-'.$_POST['date_end'.$suffixe.'month'].'-'.$_POST['date_end'.$suffixe.'day']; $date_end=$_POST['date_end'.$suffixe.'year'].'-'.$_POST['date_end'.$suffixe.'month'].'-'.$_POST['date_end'.$suffixe.'day'];
// If hour/minute are specified, append them // If hour/minute are specified, append them
if (($_POST['date_end'.$suffixe.'hour']) && ($_POST['date_end'.$suffixe.'min'])) if (($_POST['date_end'.$suffixe.'hour']) && ($_POST['date_end'.$suffixe.'min']))
$date_end.=' '.$_POST['date_end'.$suffixe.'hour'].':'.$_POST['date_end'.$suffixe.'min']; $date_end.=' '.$_POST['date_end'.$suffixe.'hour'].':'.$_POST['date_end'.$suffixe.'min'];
} }
$price_base_type = 'HT'; $price_base_type = 'HT';
@ -905,7 +905,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
$info_bits=0; $info_bits=0;
if ($tva_npr) $info_bits |= 0x01; if ($tva_npr) $info_bits |= 0x01;
if($prod->price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($prod->price_min))) if($prod->price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($prod->price_min)))
{ {
$fac->error = $langs->trans("CantBeLessThanMinPrice",price2num($prod->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)) ; $fac->error = $langs->trans("CantBeLessThanMinPrice",price2num($prod->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)) ;
@ -935,13 +935,13 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
if ($result > 0) if ($result > 0)
{ {
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($_REQUEST['lang_id'])) if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
} }
else else
{ {
@ -965,14 +965,14 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
$date_start=$_POST['date_startyear'].'-'.$_POST['date_startmonth'].'-'.$_POST['date_startday']; $date_start=$_POST['date_startyear'].'-'.$_POST['date_startmonth'].'-'.$_POST['date_startday'];
// If hour/minute are specified, append them // If hour/minute are specified, append them
if (($_POST['date_starthour']) && ($_POST['date_startmin'])) if (($_POST['date_starthour']) && ($_POST['date_startmin']))
$date_start.=' '.$_POST['date_starthour'].':'.$_POST['date_startmin']; $date_start.=' '.$_POST['date_starthour'].':'.$_POST['date_startmin'];
} }
if ($_POST['date_endyear'] && $_POST['date_endmonth'] && $_POST['date_endday']) if ($_POST['date_endyear'] && $_POST['date_endmonth'] && $_POST['date_endday'])
{ {
$date_end=$_POST['date_endyear'].'-'.$_POST['date_endmonth'].'-'.$_POST['date_endday']; $date_end=$_POST['date_endyear'].'-'.$_POST['date_endmonth'].'-'.$_POST['date_endday'];
// If hour/minute are specified, append them // If hour/minute are specified, append them
if (($_POST['date_endhour']) && ($_POST['date_endmin'])) if (($_POST['date_endhour']) && ($_POST['date_endmin']))
$date_end.=' '.$_POST['date_endhour'].':'.$_POST['date_endmin']; $date_end.=' '.$_POST['date_endhour'].':'.$_POST['date_endmin'];
} }
// Define info_bits // Define info_bits
@ -1006,16 +1006,16 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
'HT', 'HT',
$info_bits $info_bits
); );
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($_REQUEST['lang_id'])) if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
} }
$_GET['facid']=$_POST['facid']; // Pour réaffichage de la fiche en cours d'édition $_GET['facid']=$_POST['facid']; // Pour réaffichage de la fiche en cours d'édition
} }
@ -1036,12 +1036,12 @@ if ($_GET['action'] == 'up' && $user->rights->facture->creer)
$fac->fetch($_GET['facid']); $fac->fetch($_GET['facid']);
$fac->line_up($_GET['rowid']); $fac->line_up($_GET['rowid']);
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($_REQUEST['lang_id'])) if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET["facid"].'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET["facid"].'#'.$_GET['rowid']);
exit; exit;
@ -1053,12 +1053,12 @@ if ($_GET['action'] == 'down' && $user->rights->facture->creer)
$fac->fetch($_GET['facid']); $fac->fetch($_GET['facid']);
$fac->line_down($_GET['rowid']); $fac->line_down($_GET['rowid']);
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($_REQUEST['lang_id'])) if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET["facid"].'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET["facid"].'#'.$_GET['rowid']);
exit; exit;
@ -1279,12 +1279,12 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$fac->setDocModel($user, $_REQUEST['model']); $fac->setDocModel($user, $_REQUEST['model']);
} }
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($_REQUEST['lang_id'])) if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
$result=facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); $result=facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
if ($result <= 0) if ($result <= 0)
{ {
@ -1406,7 +1406,7 @@ if ($_GET['action'] == 'create')
print '</td></tr>'; print '</td></tr>';
} }
// Factures prédéfinnies // Factures prédéfinnies
// TODO Use instead invoice in llx_facture table with a particular status // TODO Use instead invoice in llx_facture table with a particular status
if ($conf->global->FACTURE_ENABLE_RECUR) if ($conf->global->FACTURE_ENABLE_RECUR)
{ {
@ -1464,7 +1464,7 @@ if ($_GET['action'] == 'create')
$options.=' ('.$facturestatic->LibStatut(0,$facparam['status']).')'; $options.=' ('.$facturestatic->LibStatut(0,$facparam['status']).')';
$options.='</option>'; $options.='</option>';
} }
$facids=$facturestatic->list_qualified_avoir_invoices($soc->id); $facids=$facturestatic->list_qualified_avoir_invoices($soc->id);
if ($facids < 0) if ($facids < 0)
{ {
@ -1652,7 +1652,7 @@ if ($_GET['action'] == 'create')
//print '<input type="hidden" name="remise_absolue" value="'.$commande->remise_absolue.'">'."\n"; //print '<input type="hidden" name="remise_absolue" value="'.$commande->remise_absolue.'">'."\n";
//print '<input type="hidden" name="remise_percent" value="'.$commande->remise_percent.'">'."\n"; //print '<input type="hidden" name="remise_percent" value="'.$commande->remise_percent.'">'."\n";
print '<input type="hidden" name="commandeid" value="'.$commande->id.'">'; print '<input type="hidden" name="commandeid" value="'.$commande->id.'">';
print '<tr><td>'.$langs->trans('Order').'</td><td colspan="2"><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$commande->ref.'</a></td></tr>'; print '<tr><td>'.$langs->trans('Order').'</td><td colspan="2"><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$commande->ref.'</a></td></tr>';
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($commande->total_ht).'</td></tr>'; print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($commande->total_ht).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($commande->total_tva)."</td></tr>"; print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($commande->total_tva)."</td></tr>";
@ -1897,13 +1897,13 @@ else
//$resteapayer=bcadd($fac->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT); //$resteapayer=bcadd($fac->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT); //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($fac->total_ttc - $totalpaye - $totalavoir,'MT'); $resteapayer = price2num($fac->total_ttc - $totalpaye - $totalavoir,'MT');
if ($fac->paye) $resteapayer=0; if ($fac->paye) $resteapayer=0;
$resteapayeraffiche=$resteapayer; $resteapayeraffiche=$resteapayer;
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); $absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); $absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
$author = new User($db); $author = new User($db);
if ($fac->user_author) if ($fac->user_author)
{ {
@ -2047,20 +2047,20 @@ else
print '<br>'; print '<br>';
} }
// Clone confirmation // Clone confirmation
if ($_GET["action"] == 'clone') if ($_GET["action"] == 'clone')
{ {
// Create an array for form // Create an array for form
$formquestion=array( $formquestion=array(
//'text' => $langs->trans("ConfirmClone"), //'text' => $langs->trans("ConfirmClone"),
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1) //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1)
); );
// Paiement incomplet. On demande si motif = escompte ou autre // Paiement incomplet. On demande si motif = escompte ou autre
$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$fac->ref),'confirm_clone',$formquestion,'yes'); $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$fac->ref),'confirm_clone',$formquestion,'yes');
print '<br>'; print '<br>';
} }
// Invoice content // Invoice content
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -2911,7 +2911,7 @@ else
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>'; print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>';
} }
} }
// Valider // Valider
if ($fac->statut == 0 && $num_lignes > 0 && (($fac->type < 2 && $fac->total_ttc >= 0) || ($fac->type == 2 && $fac->total_ttc <= 0))) if ($fac->statut == 0 && $num_lignes > 0 && (($fac->type < 2 && $fac->total_ttc >= 0) || ($fac->type == 2 && $fac->total_ttc <= 0)))
{ {
@ -3028,7 +3028,7 @@ else
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=clone&amp;object=invoice">'.$langs->trans("ToClone").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=clone&amp;object=invoice">'.$langs->trans("ToClone").'</a>';
} }
// Clone as predefined // Clone as predefined
if ($conf->global->FACTURE_ENABLE_RECUR && $fac->type == 0 && $fac->statut == 0 && $user->rights->facture->creer) if ($conf->global->FACTURE_ENABLE_RECUR && $fac->type == 0 && $fac->statut == 0 && $user->rights->facture->creer)
{ {

View File

@ -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$');

View File

@ -57,10 +57,11 @@ 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='')
{ {
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author,bc.fk_bank_account,bc.amount,bc.number,bc.statut,bc.nbcheque"; $sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author,bc.fk_bank_account,bc.amount,bc.number,bc.statut,bc.nbcheque";
@ -108,11 +109,11 @@ 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)
{ {
$this->errno = 0; $this->errno = 0;
@ -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;

View File

@ -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

View File

@ -64,20 +64,26 @@ class BordereauChequeBlochet extends FPDF
$this->marge_haute=10; $this->marge_haute=10;
$this->marge_basse=10; $this->marge_basse=10;
$this->line_height = 5; // 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_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;
} }
/** /**
* \brief Fonction generant le rapport sur le disque * \brief Fonction generant le rapport sur le disque
* \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);