diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 9638af5f2f0..eaabf9bfcde 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -37,6 +37,11 @@ if (!$user->rights->banque->lire) $statut=isset($_GET["statut"])?$_GET["statut"]:''; + +/* + * View + */ + llxHeader(); diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index baf8308407e..991e36e3d62 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -16,34 +16,54 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** - \file htdocs/compta/facture/impayees.php - \ingroup facture - \brief Page de liste des factures clients impayées - \version $Revision$ -*/ + * \file htdocs/compta/facture/impayees.php + * \ingroup facture + * \brief Page to list and build liste of unpayed invoices + * \version $Revision$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/paiement.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/includes/fpdf/fpdfi/fpdi.php"); $langs->load("bills"); -// Security check $facid = isset($_GET["facid"])?$_GET["facid"]:''; +$option = $_REQUEST["option"]; + +// Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'facture',$facid,''); -llxHeader('',$langs->trans("BillsCustomersUnpayed")); +/* + * View + */ +$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); +?> +rights->facture->lire) +if ($_POST["action"] == "builddoc" && $user->rights->facture->lire) { - $limit = $conf->liste_limit; - $offset = $limit * $page ; - - $sql = "SELECT s.nom, s.rowid as socid"; - $sql.= ", f.facnumber,f.increment,f.total as total_ht,f.total_ttc"; - $sql.= ", ".$db->pdate("f.datef")." as df, ".$db->pdate("f.date_lim_reglement")." as datelimite"; - $sql.= ", f.paye as paye, f.rowid as facid, f.fk_statut"; - $sql.= ", sum(pf.amount) as am"; - if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= ",".MAIN_DB_PREFIX."facture as f"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; - $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND f.paye = 0 AND f.fk_statut = 1"; - if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql .= " AND s.rowid = ".$socid; - - if ($_GET["filtre"]) + if (is_array($_POST['toGenerate'])) { - $filtrearr = split(",", $_GET["filtre"]); - foreach ($filtrearr as $fil) - { - $filt = split(":", $fil); - $sql .= " AND " . $filt[0] . " = " . $filt[1]; - } - } + + $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('\.pdf|',$_POST['toGenerate']).'\.pdf','\.meta$|\.png','date',SORT_DESC) ; - if ($_GET["search_ref"]) - { - $sql .= " AND f.facnumber like '%".$_GET["search_ref"]."%'"; - } - - if ($_GET["search_societe"]) - { - $sql .= " AND s.nom like '%".$_GET["search_societe"]."%'"; - } - - if ($_GET["search_montant_ht"]) - { - $sql .= " AND f.total = '".$_GET["search_montant_ht"]."'"; - } - - if ($_GET["search_montant_ttc"]) - { - $sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'"; - } - - if (strlen($_POST["sf_ref"]) > 0) - { - $sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'"; - } - $sql.= " GROUP BY f.facnumber"; - - $sql.= " ORDER BY "; - $listfield=split(',',$sortfield); - foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.","; - $sql.= " f.facnumber DESC"; - - //$sql .= $db->plimit($limit+1,$offset); - - $result = $db->query($sql); - - if ($result) - { - $num = $db->num_rows($result); - - if ($socid) - { - $soc = new Societe($db); - $soc->fetch($socid); - } - - $titre=($socid?$langs->trans("BillsCustomersUnpayedForCompany",$soc->nom):$langs->trans("BillsCustomersUnpayed")); - print_barre_liste($titre,$page,"impayees.php","&socid=$socid",$sortfield,$sortorder,'',0); // We don't want pagination on this page - $i = 0; - print ''; - print ''; - - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=$socid","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","","&socid=$socid",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","","&socid=$socid",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&socid=$socid",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","","&socid=$socid",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","","&socid=$socid",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","","&socid=$socid",'align="right"',$sortfield,$sortorder); - print "\n"; - - // Lignes des champs de filtre - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - print ''; - - - $facturestatic=new Facture($db); - - - if ($num > 0) - { - $var=True; - $total_ht=0; - $total_ttc=0; - $total_payed=0; - - while ($i < $num) - { - $objp = $db->fetch_object($result); - - $var=!$var; - - print ""; - $class = "impayee"; - - print '\n"; - - print "\n"; - print "\n"; - - print ''; - - print ""; - print ""; - print ""; - - // Affiche statut de la facture - print ''; - - print "\n"; - $total_ht+=$objp->total_ht; - $total_ttc+=$objp->total_ttc; - $total_payed+=$objp->am; - - $i++; + // liste les fichiers + $files = array() ; + $factures_bak = $factures ; + foreach($_POST['toGenerate'] as $basename){ + foreach($factures as $facture){ + if(strstr($facture["name"],$basename)){ + $files[] = $conf->facture->dir_output.'/'.$basename.'/'.$facture["name"] ; + } } - - print ''; - print ""; - print ""; - print ""; - print ""; - print ''; - print "\n"; } - - print "
'; - print '  '; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - - $facturestatic->id=$objp->facid; - $facturestatic->ref=$objp->facnumber; - $facturestatic->type=$objp->type; - - print ''; - print ''; - - print ''; - - print '
'; - print $facturestatic->getNomUrl(1); - print ''; - if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late")); - print ''; - - $filename=sanitize_string($objp->facnumber); - $filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber); - $urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid; - $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1); - - print '
'; - - print "
".dolibarr_print_date($objp->df)."".dolibarr_print_date($objp->datelimite)."'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,32).'".price($objp->total_ht)."".price($objp->total_ttc)."".price($objp->am)."'; - print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); - print '
".$langs->trans("Total").": ".price($total_ht)."".price($total_ttc)."".price($total_payed)." 
"; - $db->free(); - } + + // génère le PDF à partir de tous les autres fichiers + $pdf=new FPDI(); + foreach($files as $file){ + // Charge un document PDF depuis un fichier. + $pagecount = $pdf->setSourceFile($file); + for ($i = 1; $i <= $pagecount; $i++) { + $tplidx = $pdf->ImportPage($i); + $s = $pdf->getTemplatesize($tplidx); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tplidx); + } + } + + // vérifie que le chemin d'accès est bien accessible + create_exdir($diroutputpdf); + + // enregistre le fichier pdf concaténé + $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'); + + } else { - dolibarr_print_error($db); + $mesg='
'.$langs->trans('UnpayedNotChecked').'
' ; + } +} + +$limit = $conf->liste_limit; +$offset = $limit * $page ; + +$sql = "SELECT s.nom, s.rowid as socid"; +$sql.= ", f.facnumber,f.increment,f.total as total_ht,f.total_ttc"; +$sql.= ", ".$db->pdate("f.datef")." as df, ".$db->pdate("f.date_lim_reglement")." as datelimite"; +$sql.= ", f.paye as paye, f.rowid as facid, f.fk_statut"; +$sql.= ", sum(pf.amount) as am"; +if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; +$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; +if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql.= ",".MAIN_DB_PREFIX."facture as f"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; +$sql.= " WHERE f.fk_soc = s.rowid"; +$sql.= " AND f.type in (0,1) AND f.fk_statut = 1"; +$sql.= " AND f.paye = 0"; +if ($option == 'late') +{ + $sql.=" AND f.date_lim_reglement < ".$db->idate(mktime()); +} +if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) $sql .= " AND s.rowid = ".$socid; + +if ($_GET["filtre"]) +{ + $filtrearr = split(",", $_GET["filtre"]); + foreach ($filtrearr as $fil) + { + $filt = split(":", $fil); + $sql .= " AND " . $filt[0] . " = " . $filt[1]; + } +} + +if ($_GET["search_ref"]) +{ + $sql .= " AND f.facnumber like '%".$_GET["search_ref"]."%'"; +} + +if ($_GET["search_societe"]) +{ + $sql .= " AND s.nom like '%".$_GET["search_societe"]."%'"; +} + +if ($_GET["search_montant_ht"]) +{ + $sql .= " AND f.total = '".$_GET["search_montant_ht"]."'"; +} + +if ($_GET["search_montant_ttc"]) +{ + $sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'"; +} + +if (strlen($_POST["sf_ref"]) > 0) +{ + $sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'"; +} +$sql.= " GROUP BY f.facnumber"; + +$sql.= " ORDER BY "; +$listfield=split(',',$sortfield); +foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.","; +$sql.= " f.facnumber DESC"; + +//$sql .= $db->plimit($limit+1,$offset); + +$result = $db->query($sql); + +if ($result) +{ + $num = $db->num_rows($result); + + if ($socid) + { + $soc = new Societe($db); + $soc->fetch($socid); } + $param="&socid=".$socid."&option=".$option; + + $titre=($socid?$langs->trans("BillsCustomersUnpayedForCompany",$soc->nom):$langs->trans("BillsCustomersUnpayed")); + if ($option == 'late') $titre.=' ('.$langs->trans("Late").')'; + else $titre.=' ('.$langs->trans("All").')'; + + $link=''; + if (empty($option)) $link=''.$langs->trans("ShowUnpayedLateOnly").''; + elseif ($option == 'late') $link=''.$langs->trans("ShowUnpayedAll").''; + print_fiche_titre($titre,$link); + //print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',0); // We don't want pagination on this page + + if ($mesg) print $mesg; + + $i = 0; + print ''; + print ''; + + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Generate"),$_SERVER["PHP_SELF"],""); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder); + print "\n"; + + // Lignes des champs de filtre + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + print ''; + + + $facturestatic=new Facture($db); + + + if ($num > 0) + { + $var=True; + $total_ht=0; + $total_ttc=0; + $total_payed=0; + + print ''; + + while ($i < $num) + { + $objp = $db->fetch_object($result); + + $var=!$var; + + print ""; + $class = "impayee"; + + print '' ; + + print "\n"; + + print "\n"; + print "\n"; + + print ''; + + print ""; + print ""; + print ""; + + // Affiche statut de la facture + print ''; + + print "\n"; + $total_ht+=$objp->total_ht; + $total_ttc+=$objp->total_ttc; + $total_payed+=$objp->am; + + $i++; + } + + print ''; + print ""; + print ""; + print ""; + print ""; + print ''; + print "\n"; + } + + print "
'; + print '  '; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + + $facturestatic->id=$objp->facid; + $facturestatic->ref=$objp->facnumber; + $facturestatic->type=$objp->type; + + print ''; + print ''; + + print ''; + + print '
'; + print $facturestatic->getNomUrl(1); + print ''; + if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late")); + print ''; + + $filename=sanitize_string($objp->facnumber); + $filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber); + $urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid; + $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1); + + print '
'; + + print '
".dolibarr_print_date($objp->df)."".dolibarr_print_date($objp->datelimite)."'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,32).'".price($objp->total_ht)."".price($objp->total_ttc)."".price($objp->am)."'; + print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); + print '
".$langs->trans("Total").": ".price($total_ht)."".price($total_ttc)."".price($total_payed)." 
"; + + + /* + * Show list of available documents + */ + $filedir=$diroutputpdf; + $urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id; + $genallowed=$user->rights->facture->lire; + $delallowed=$user->rights->facture->lire; + + print '
'; + print ''; + $formfile->show_documents('unpayed','',$filedir,$urlsource,$genallowed,$delallowed,'','',0,0,48,1); + print ''; + + $db->free(); } diff --git a/htdocs/compta/facture/retardspaiement.php b/htdocs/compta/facture/retardspaiement.php deleted file mode 100644 index a27f78f9b14..00000000000 --- a/htdocs/compta/facture/retardspaiement.php +++ /dev/null @@ -1,367 +0,0 @@ - - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - \file htdocs/compta/facture/retardspaiement.php - \ingroup facture - \brief Page generation PDF factures clients impayées - \version $Revision$ -*/ - -require("./pre.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); -require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); -require_once(DOL_DOCUMENT_ROOT."/paiement.class.php"); -require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/includes/fpdf/fpdfi/fpdi.php"); - -$langs->load("bills"); - -// Security check -$facid = isset($_GET["facid"])?$_GET["facid"]:''; -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'facture',$facid,''); - - -/* - * View - */ - -$diroutputpdf=$conf->facture->dir_output . '/impayes/temp'; - -llxHeader('',$langs->trans("BillsLate")); - -$html = new Form($db); -$formfile = new FormFile($db); -?> -rights->facture->lire) -{ - - - if ($_POST["action"] == "generate_pdf"){ - if(is_array($_POST['toGenerate'])) - { - - $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('\.pdf|',$_POST['toGenerate']).'\.pdf','\.meta$|\.png','date',SORT_DESC) ; - - // liste les fichiers - $files = array() ; - $factures_bak = $factures ; - foreach($_POST['toGenerate'] as $basename){ - foreach($factures as $facture){ - if(strstr($facture["name"],$basename)){ - $files[] = DOL_DATA_ROOT . '/facture/' . $basename . '/' . $facture["name"] ; - } - } - } - - // génère le PDF à partir de tous les autres fichiers - $pdf=new FPDI(); - foreach($files as $file){ - // Charge un document PDF depuis un fichier. - $pagecount = $pdf->setSourceFile($file); - for ($i = 1; $i <= $pagecount; $i++) { - $tplidx = $pdf->ImportPage($i); - $s = $pdf->getTemplatesize($tplidx); - $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); - $pdf->useTemplate($tplidx); - } - } - - // vérifie que le chemin d'accès est bien accessible - create_exdir($diroutputpdf); - - // enregistre le fichier pdf concaténé - $pdf->Output($diroutputpdf.'/impayes'.dolibarr_date('YmdHis',time()).'.pdf'); - - } else { - print '
'.$langs->trans('UnpayedNotChecked').'
' ; - } - } - - $limit = $conf->liste_limit; - $offset = $limit * $page ; - - $sql = "SELECT s.nom, s.rowid as socid"; - $sql.= ", f.facnumber,f.increment,f.total as total_ht,f.total_ttc"; - $sql.= ", ".$db->pdate("f.datef")." as df, ".$db->pdate("f.date_lim_reglement")." as datelimite"; - $sql.= ", f.paye as paye, f.rowid as facid, f.fk_statut"; - $sql.= ", sum(pf.amount) as am"; - if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= ",".MAIN_DB_PREFIX."facture as f"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; - $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND f.paye = 0 AND f.fk_statut = 1 AND f.date_lim_reglement < NOW()"; - if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql .= " AND s.rowid = ".$socid; - - if ($_GET["filtre"]) - { - $filtrearr = split(",", $_GET["filtre"]); - foreach ($filtrearr as $fil) - { - $filt = split(":", $fil); - $sql .= " AND " . $filt[0] . " = " . $filt[1]; - } - } - - if ($_GET["search_ref"]) - { - $sql .= " AND f.facnumber like '%".$_GET["search_ref"]."%'"; - } - - if ($_GET["search_societe"]) - { - $sql .= " AND s.nom like '%".$_GET["search_societe"]."%'"; - } - - if ($_GET["search_montant_ht"]) - { - $sql .= " AND f.total = '".$_GET["search_montant_ht"]."'"; - } - - if ($_GET["search_montant_ttc"]) - { - $sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'"; - } - - if (strlen($_POST["sf_ref"]) > 0) - { - $sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'"; - } - $sql.= " GROUP BY f.facnumber"; - - $sql.= " ORDER BY "; - $listfield=split(',',$sortfield); - foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.","; - $sql.= " f.facnumber DESC"; - - //$sql .= $db->plimit($limit+1,$offset); - - $result = $db->query($sql); - - if ($result) - { - $num = $db->num_rows($result); - - if ($socid) - { - $soc = new Societe($db); - $soc->fetch($socid); - } - - $titre=($socid?$langs->trans("BillsCustomersUnpayedForCompany",$soc->nom):$langs->trans("BillsLate")); - print_barre_liste($titre,$page,"retardspaiement.php","&socid=$socid",$sortfield,$sortorder,'',0); // We don't want pagination on this page - $i = 0; - print ''; - print ''; - - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=$socid","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Generate"),$_SERVER["PHP_SELF"],""); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","","&socid=$socid",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","","&socid=$socid",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&socid=$socid",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","","&socid=$socid",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","","&socid=$socid",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","","&socid=$socid",'align="right"',$sortfield,$sortorder); - print "\n"; - - // Lignes des champs de filtre - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - print ''; - - - $facturestatic=new Facture($db); - - if ($num > 0) - { - $var=True; - $total_ht=0; - $total_ttc=0; - $total_payed=0; - - print ''; - print ''; - - while ($i < $num) - { - $objp = $db->fetch_object($result); - - $var=!$var; - - print ""; - $class = "impayee"; - - print '' ; - - print "\n"; - - print "\n"; - print "\n"; - - print ''; - - print ""; - print ""; - print ""; - - // Affiche statut de la facture - print ''; - - print "\n"; - $total_ht+=$objp->total_ht; - $total_ttc+=$objp->total_ttc; - $total_payed+=$objp->am; - - $i++; - } - - print ''; - print ""; - print ""; - print ""; - print ""; - print ''; - print "\n"; - } - - print "
'; - print '  '; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - - $facturestatic->id=$objp->facid; - $facturestatic->ref=$objp->facnumber; - $facturestatic->type=$objp->type; - - print ''; - print ''; - - print ''; - - print '
'; - print $facturestatic->getNomUrl(1); - print ''; - if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late")); - print ''; - - $filename=sanitize_string($objp->facnumber); - $filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber); - $urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid; - $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1); - - print '
'; - - print '
".dolibarr_print_date($objp->df)."".dolibarr_print_date($objp->datelimite)."'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,32).'".price($objp->total_ht)."".price($objp->total_ttc)."".price($objp->am)."'; - print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); - print '
".$langs->trans("Total").": ".price($total_ht)."".price($total_ttc)."".price($total_payed)." 
"; - - /* - * Gestion des documents générés - */ - $filedir=$diroutputpdf; - $urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id; - $genallowed=$user->rights->facture->creer; - $delallowed=$user->rights->facture->supprimer; - - //class="pair" ou "impair" pour les tr - $var = false ; $bc = array("pair","impair") ; - - // liste des fichier - $file_list=dol_dir_list($filedir,'files',0,'impayes.*','\.meta$','date',SORT_DESC);; - - print '
' ; - print_titre($langs->trans("Documents")); - print ''; - print '' ; - print '' ; - print '' ; - // Pour chaque fichier on affiche une ligne - foreach($file_list as $file){ - $filepath = $filedir."/".$file["name"] ; - $var = !$var ; - print '' ; - // Nom du fichier - print '' ; - // Taille - print '' ; - // Date - print '' ; - // Suppression - print '' ; - print '' ; - } - - print '
'.$langs->trans("File").''.$langs->trans("Size").''.$langs->trans("Date").'
'.img_pdf($file["name"],2)." ".$file["name"].''.filesize($filepath). ' bytes'.dolibarr_print_date(filemtime($filepath),'dayhour').''.img_delete().'
'; - - print ''; - - $db->free(); - - - } - else - { - dolibarr_print_error($db); - } - -} - - - -$db->close(); - -llxFooter('$Date$ - $Revision$'); -?> diff --git a/htdocs/document.php b/htdocs/document.php index f0cb5087ba6..2e54d2435e1 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -109,14 +109,14 @@ if ($modulepart) $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='$refname'"; } - if ($modulepart == 'impayes') + if ($modulepart == 'unpayed') { $user->getrights('facture'); if ($user->rights->facture->lire || eregi('^specimen',$original_file)) { $accessallowed=1; } - $original_file=$original_file; + $original_file=$conf->facture->dir_output.'/unpayed/temp/'.$original_file; } // Wrapping pour les fiches intervention diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php index ffd5aa08d64..7272684a185 100644 --- a/htdocs/html.formfile.class.php +++ b/htdocs/html.formfile.class.php @@ -17,15 +17,15 @@ */ /** - \file htdocs/html.formfile.class.php - \brief Fichier de la classe des fonctions prédéfinie de composants html fichiers - \version $Id$ + * \file htdocs/html.formfile.class.php + * \brief Fichier de la classe des fonctions prédéfinie de composants html fichiers + * \version $Id$ */ /** - \class FormFile - \brief Classe permettant la génération de composants html fichiers + * \class FormFile + * \brief Classe permettant la génération de composants html fichiers */ class FormFile { @@ -116,15 +116,16 @@ class FormFile * \param genallowed Génération autorisée (1/0 ou array des formats) * \param delallowed Suppression autorisée (1/0) * \param modelselected Modele à pré-sélectionner par défaut - * \param modelliste Tableau des modeles possibles + * \param modelliste Tableau des modeles possibles. Use '' to hide combo select list. * \param forcenomultilang N'affiche pas option langue meme si MAIN_MULTILANGS défini * \param iconPDF N'affiche que l'icone PDF avec le lien (1/0) * \param maxfilenamelength Max length for filename shown + * \param noform Do not output html form start and end * \remarks Le fichier de facture détaillée est de la forme * REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse * \return int <0 si ko, nbre de fichiers affichés si ok */ - function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28) + function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0) { // filedir = conf->...dir_ouput."/".get_exdir(id) include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); @@ -145,6 +146,9 @@ class FormFile $headershown=0; $i=0; + print "\n".''."\n"; + //print 'filedir='.$filedir; + // Affiche en-tete tableau if ($genallowed) { @@ -247,6 +251,10 @@ class FormFile // ?? } } + else if ($modulepart == 'unpayed') + { + $modellist=''; + } else { dolibarr_print_error($this->db,'Bad value for modulepart'); @@ -256,17 +264,26 @@ class FormFile $headershown=1; $html = new Form($db); - - print '
'; + $texte=$langs->trans('Generate'); + + if (empty($noform)) print ''; print ''; print_titre($langs->trans("Documents")); print ''; print ''; - print ''; print '
'.$langs->trans('Model').' '; - $html->select_array('model',$modellist,$modelselected,0,0,1); - $texte=$langs->trans('Generate'); + if (! empty($modellist)) + { + print ''; + print $langs->trans('Model').' '; + $html->select_array('model',$modellist,$modelselected,0,0,1); + } + else + { + print ''; + print $langs->trans("Files"); + } print ''; if($conf->global->MAIN_MULTILANGS && ! $forcenomultilang) @@ -350,10 +367,10 @@ class FormFile print "
\n"; if ($genallowed) { - print '
'; + if (empty($noform)) print ''."\n"; } } - + print ''."\n"; return ($i?$i:$headershown); } diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php index fa3989389b1..66299aaa53b 100644 --- a/htdocs/includes/menus/barre_left/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php @@ -421,11 +421,11 @@ class MenuLeft { } if (! $conf->global->FACTURE_DISABLE_RECUR) { - if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatable"),2,$user->rights->facture->lire); + if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),2,$user->rights->facture->lire); } if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpayed"),2,$user->rights->facture->lire); - if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/retardspaiement.php?leftmenu=customers_bills",$langs->trans("BillsLate"),2,$user->rights->facture->lire); + if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/impayees.php?option=late&leftmenu=customers_bills",$langs->trans("Unpayed").' ('.$langs->trans("Late").')',2,$user->rights->facture->lire); if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/paiement/liste.php?leftmenu=customers_bills_payments",$langs->trans("Payments"),2,$user->rights->facture->lire); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 30fd1b69310..6ced22a5db6 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -195,6 +195,7 @@ Billed=Billed RepeatableInvoice=Repeatable invoice RepeatableInvoices=Repeatable invoices Repeatable=Repeatable +Repeatables=Repeatable ChangeIntoRepeatableInvoice=Change into repeatable CreateRepeatableInvoice=Create repeatable invoice CreateFromRepeatableInvoice=Create from repeatable invoice diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 165c443c1df..2dd6fc63e82 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -349,6 +349,7 @@ Legend=Legend FillTownFromZip=Fill town from zip ShowLog=Show log File=File +Files=Files ReadPermissionNotAllowed=Read permission not allowed AmountInCurrency=Amount in %s currency Example=Example diff --git a/htdocs/langs/es_ES/bills.lang b/htdocs/langs/es_ES/bills.lang index bc4bc252045..970b27d3b82 100644 --- a/htdocs/langs/es_ES/bills.lang +++ b/htdocs/langs/es_ES/bills.lang @@ -196,6 +196,7 @@ Billed=Facturado RepeatableInvoice=Factura recurrente RepeatableInvoices=Facturas recurrentes Repeatable=Recurrente +Repeatables=Recurrentes ChangeIntoRepeatableInvoice=Modificar en recurrente CreateRepeatableInvoice=Crear factura recurrente CreateFromRepeatableInvoice=Crear despues factura recurrente diff --git a/htdocs/langs/fr_BE/bills.lang b/htdocs/langs/fr_BE/bills.lang index 760ceb82bb2..493e953a378 100644 --- a/htdocs/langs/fr_BE/bills.lang +++ b/htdocs/langs/fr_BE/bills.lang @@ -157,12 +157,6 @@ NonPercuRecuperable=Non per SetConditions=Définir conditions de règlement SetMode=Définir mode de règlement Billed=Facturé -RepeatableInvoice=Facture récurrente -RepeatableInvoices=Factures récurrentes -Repeatable=Récurrente -ChangeIntoRepeatableInvoice=Modifier en récurrente -CreateRepeatableInvoice=Créer facture récurrente -CreateFromRepeatableInvoice=Créer depuis facture récurrente ExportDataset_invoice_1=Factures clients et lignes de facture ProformaBill=Facture Proforma : Reduction=Réduction diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 3c87ffa918c..57f4d3232fc 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -194,6 +194,7 @@ Billed=Factur RepeatableInvoice=Facture récurrente RepeatableInvoices=Factures récurrentes Repeatable=Récurrente +Repeatables=Récurrentes ChangeIntoRepeatableInvoice=Convertir en récurrente CreateRepeatableInvoice=Créer facture récurrente CreateFromRepeatableInvoice=Créer depuis facture récurrente @@ -308,7 +309,8 @@ ChequeDeposits=D Cheques=Chèques CreditNoteConvertedIntoDiscount=Cet avoir a été converti en %s UsBillingContactAsIncoiveRecipientIfExist=Utiliser l'adresse du contact facturation client de la facture plutot que l'adresse du tiers comme destinataire des factures - +ShowUnpayedAll=Afficher tous les impayés +ShowUnpayedLateOnly=Afficher impayés en retard uniquement # oursin PDF model Of=du @@ -342,18 +344,3 @@ IsNotDefined=N'est pas d TerreNumRefModelDesc1=Renvoie le numéro sous la forme %syymm-nnnn pour les factures et %syymm-nnnn pour les avoirs où yy est l'année, mm le mois et nnnn un compteur séquentiel sans rupture et sans remise à 0 TerreNumRefModelError=Une facture commençant par $syymm existe en base et est incompatible avec cette numérotation. Supprimer la ou renommer la pour activer ce module. - -# Deprecated - -# orion -OrionNumRefModelDesc1=Renvoie le numéro sous la forme FAYYNNNNN où YY est l'année et NNNNN le numéro d'incrément qui commence à 1. -OrionNumRefModelDesc2=L'année s'incrémente de 1 SANS remise à zero en début d'année d'exercice. -OrionNumRefModelDesc3=Définir le mois de début d'exercice dans configuration->société, ex: septembre. -OrionNumRefModelDesc4=Dans cet exemple nous aurons au 1er septembre 2007 une facture nommée FA0800354. -# titan -TitanNumRefModelDesc1=Renvoie le numéro sous la forme FAYYNNNNN où YY est l'année et NNNNN le numéro d'incrément qui commence à 1. -TitanNumRefModelDesc2=L'année s'incrémente de 1 et le numéro d'incrément se remet à zero en début d'année d'exercice. -TitanNumRefModelDesc3=Définir le mois de début d'exercice dans configuration->société, ex: septembre. -TitanNumRefModelDesc4=Dans cet exemple nous aurons au 1er septembre 2007 une facture nommée FA0800001. -# pluton -PlutonNumRefModelDesc1=Renvoie un numéro de facture personalisable selon un masque à définir. diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 846b555e6a0..74752018d0e 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -351,6 +351,7 @@ Legend=L FillTownFromZip=Renseigner ville ShowLog=Afficher historique File=Fichier +Files=Fichiers ReadPermissionNotAllowed=Lecture non autorisée AmountInCurrency=Montants exprimés en %s Example=Exemple diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 9ac630d6a76..269eb14b25e 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -424,6 +424,7 @@ function dolibarr_print_date($time,$format='',$to_gmt=false) if ($format == 'daytext') $format=$conf->format_date_text_short; if ($format == 'dayhour') $format=$conf->format_date_hour_short; if ($format == 'dayhourtext') $format=$conf->format_date_hour_text_short; + if ($format == 'dayhourlog') $format='%Y%m%d%H%M%S'; if ($format == 'dayhourldap') $format='%Y%m%d%H%M%SZ'; if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ'; @@ -1829,7 +1830,7 @@ function dol_avscan_file($file) /** \brief Fonction print_barre_liste \param titre Titre de la page - \param page num�ro de la page + \param page numero de la page \param file lien \param options parametres complementaires lien ('' par defaut) \param sortfield champ de tri ('' par defaut)