Skip to content
Snippets Groups Projects
Commit e3d0eeba authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Code respect MVC

parent b3389ea8
No related branches found
No related tags found
No related merge requests found
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 ric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2008 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
......@@ -37,45 +37,16 @@ $langs->load("bills");
$facid = isset($_GET["facid"])?$_GET["facid"]:'';
$option = $_REQUEST["option"];
$diroutputpdf=$conf->facture->dir_output . '/unpayed/temp';
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture',$facid,'');
/*
* View
* Action
*/
$diroutputpdf=$conf->facture->dir_output . '/unpayed/temp';
$title=$langs->trans("BillsCustomersUnpayed");
if ($option=='late') $title=$langs->trans("BillsCustomersUnpayed");
llxHeader('',$title);
$html = new Form($db);
$formfile = new FormFile($db);
?><script type="text/javascript">
<!--
function checkall(checked){
var checkboxes = [];
checkboxes = $$('input').each(function(e){ if(e.type == 'checkbox') checkboxes.push(e) });
checkboxes.each(function(e){ e.checked = checked });
}
-->
</script>
<?php
/***************************************************************************
* *
* Mode Liste *
* *
***************************************************************************/
$page = $_GET["page"];
$sortfield=$_GET["sortfield"];
$sortorder=$_GET["sortorder"];
if (! $sortfield) $sortfield="f.date_lim_reglement";
if (! $sortorder) $sortorder="ASC";
if ($_POST["action"] == "builddoc" && $user->rights->facture->lire)
{
......@@ -95,12 +66,22 @@ if ($_POST["action"] == "builddoc" && $user->rights->facture->lire)
}
}
// gnre le PDF partir de tous les autres fichiers
$pdf=new FPDI();
foreach($files as $file){
// Create empty PDF
$pdf=new FPDI('P','mm','A4');
//$pdf->Open();
//$pdf->AddPage();
//$pdf->SetXY(100,100);
//$title=$langs->trans("BillsCustomersUnpayed");
//if ($option=='late') $title=$langs->trans("BillsCustomersUnpayed");
//$pdf->MultiCell(100, 3, $title, 0, 'J');
// Add all others
foreach($files as $file)
{
// Charge un document PDF depuis un fichier.
$pagecount = $pdf->setSourceFile($file);
for ($i = 1; $i <= $pagecount; $i++) {
for ($i = 1; $i <= $pagecount; $i++)
{
$tplidx = $pdf->ImportPage($i);
$s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
......@@ -108,14 +89,14 @@ if ($_POST["action"] == "builddoc" && $user->rights->facture->lire)
}
}
// vrifie que le chemin d'accs est bien accessible
// Create output dir if not exists
create_exdir($diroutputpdf);
// enregistre le fichier pdf concatn
// enregistre le fichier pdf concatene
$filename=sanitize_string(strtolower($langs->transnoentities("Unpayed")));
if ($option=='late') $filename.='_'.sanitize_string(strtolower($langs->transnoentities("Late")));
$pdf->Output($diroutputpdf.'/'.$filename.'_'.dolibarr_print_date(mktime(),'dayhourlog').'.pdf');
if ($pagecount) $pdf->Output($diroutputpdf.'/'.$filename.'_'.dolibarr_print_date(mktime(),'dayhourlog').'.pdf');
else $mesg='<div class="error">'.$langs->trans('NoPDFAvailableForChecked').'</div>';
}
else
{
......@@ -123,6 +104,44 @@ if ($_POST["action"] == "builddoc" && $user->rights->facture->lire)
}
}
/*
* View
*/
$title=$langs->trans("BillsCustomersUnpayed");
if ($option=='late') $title=$langs->trans("BillsCustomersUnpayed");
llxHeader('',$title);
$html = new Form($db);
$formfile = new FormFile($db);
?><script type="text/javascript">
<!--
function checkall(checked){
var checkboxes = [];
checkboxes = $$('input').each(function(e){ if(e.type == 'checkbox') checkboxes.push(e) });
checkboxes.each(function(e){ e.checked = checked });
}
-->
</script>
<?php
/***************************************************************************
* *
* Mode Liste *
* *
***************************************************************************/
$page = $_GET["page"];
$sortfield=$_GET["sortfield"];
$sortorder=$_GET["sortorder"];
if (! $sortfield) $sortfield="f.date_lim_reglement";
if (! $sortorder) $sortorder="ASC";
$limit = $conf->liste_limit;
$offset = $limit * $page ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment