diff --git a/htdocs/compta/prelevement/bon.php b/htdocs/compta/prelevement/bon.php index 6b46cc95b88..487767b5877 100644 --- a/htdocs/compta/prelevement/bon.php +++ b/htdocs/compta/prelevement/bon.php @@ -1,6 +1,7 @@ * Copyright (C) 2005 Laurent Destailleur + * Copyright (C) 2010 Juanjo Menent * * 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 @@ -25,12 +26,12 @@ */ require('../../main.inc.php'); +require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php"); require_once DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php"; $langs->load("bills"); $langs->load("categories"); - /* * Securite acces client */ @@ -39,107 +40,75 @@ if (!$user->rights->prelevement->bons->lire) accessforbidden(); llxHeader('','Bon de prelevement'); -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Card"); -$h++; - -if ($conf->use_preview_tabs) -{ - $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"]; - $head[$h][1] = $langs->trans("Preview"); - $hselected = $h; - $h++; -} - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Lines"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Bills"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Rejets"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Statistics"); -$h++; - -$prev_id = $_GET["id"]; - $html = new Form($db); if ($_GET["id"]) { - $bon = new BonPrelevement($db,""); + $bon = new BonPrelevement($db,""); - if ($bon->fetch($_GET["id"]) == 0) + if ($bon->fetch($_GET["id"]) == 0) { - dol_fiche_head($head, $hselected, 'Prelevement : '. $bon->ref); + $head = prelevement_prepare_head($bon); + dol_fiche_head($head, 'preview', 'Prelevement : '. $bon->ref); - print ''; + print '
'; - print ''; - print ''; - print ''; + print ''; + print ''; - print '
'.$langs->trans("Ref").''.$bon->ref.'
'.$langs->trans("Amount").''.price($bon->amount).'
'.$langs->trans("File").''; + print '
'.$langs->trans("Ref").''.$bon->ref.'
'.$langs->trans("Amount").''.price($bon->amount).'
'.$langs->trans("File").''; - $relativepath = 'bon/'.$bon->ref; + $relativepath = 'bon/'.$bon->ref; - print ''.$bon->ref.''; + print ''.$bon->ref.''; - print '

'; + print ''; + print '
'; - $fileimage = $conf->prelevement->dir_output.'/receipts/'.$bon->ref.'.ps.png.0'; - $fileps = $conf->prelevement->dir_output.'/receipts/'.$bon->ref.'.ps'; + $fileimage = $conf->prelevement->dir_output.'/receipts/'.$bon->ref.'.ps.png.0'; + $fileps = $conf->prelevement->dir_output.'/receipts/'.$bon->ref.'.ps'; - // Conversion du PDF en image png si fichier png non existant - if (!file_exists($fileimage)) + // Conversion du PDF en image png si fichier png non existant + if (!file_exists($fileimage)) { - print $fileimage; - if (function_exists(imagick_readimage)) - { + print $fileimage; + if (function_exists(imagick_readimage)) + { - $handle = imagick_readimage( $fileps ) ; + $handle = imagick_readimage( $fileps ) ; - if ( imagick_iserror( $handle ) ) - { - $reason = imagick_failedreason( $handle ) ; - $description = imagick_faileddescription( $handle ) ; + if ( imagick_iserror( $handle ) ) + { + $reason = imagick_failedreason( $handle ) ; + $description = imagick_faileddescription( $handle ) ; - print "handle failed!
\nReason: $reason
\nDescription: $description
\n"; + print "handle failed!
\nReason: $reason
\nDescription: $description
\n"; + } + imagick_convert( $handle, "PNG" ) ; + + if ( imagick_iserror( $handle ) ) + { + $reason = imagick_failedreason( $handle ) ; + $description = imagick_faileddescription( $handle ) ; + + print "handle failed!
\nReason: $reason
\nDescription: $description
\n"; + } + imagick_writeimage( $handle, $fileps .".png"); + } + else + { + print "Les fonctions imagick ne sont pas disponibles sur ce PHP"; + } } - imagick_convert( $handle, "PNG" ) ; - - if ( imagick_iserror( $handle ) ) + if (file_exists($fileimage)) { - $reason = imagick_failedreason( $handle ) ; - $description = imagick_faileddescription( $handle ) ; + print ''; - print "handle failed!
\nReason: $reason
\nDescription: $description
\n"; } - - imagick_writeimage( $handle, $fileps .".png"); - } - else - { - print "Les fonctions imagick ne sont pas disponibles sur ce PHP"; - } - } - - if (file_exists($fileimage)) - { - print ''; - } - } - else - { - dol_print_error($db); + else + { + dol_print_error($db); } } diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index eddecfcab13..96253098537 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010 Juanjo Menent * * 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 @@ -26,6 +27,7 @@ */ require('../../main.inc.php'); +require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php"); require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/rejet-prelevement.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php"); @@ -38,55 +40,24 @@ if ($user->societe_id > 0) accessforbidden(); llxHeader('',$langs->trans("WithdrawalReceipt")); -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Card"); -$h++; - -if ($conf->use_preview_tabs) -{ - $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"]; - $head[$h][1] = $langs->trans("Preview"); - $h++; -} - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Lines"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Bills"); -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Rejects"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Statistics"); -$h++; - - if ($_GET["id"]) { - $prev_id = $_GET["id"]; + $bon = new BonPrelevement($db,""); - $bon = new BonPrelevement($db,""); - - if ($bon->fetch($_GET["id"]) == 0) + if ($bon->fetch($_GET["id"]) == 0) { - dol_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"), '', 'payment'); + $head = prelevement_prepare_head($bon); + dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalReceipt"), '', 'payment'); - print ''; - print ''; - print '
'.$langs->trans("Ref").''.$bon->getNomUrl(1).'
'; + print ''; + print ''; + print '
'.$langs->trans("Ref").''.$bon->getNomUrl(1).'
'; - print ''; + print ''; } - else + else { - print "Erreur"; + dol_print_error($db); } } @@ -121,83 +92,83 @@ $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result); - $i = 0; + $num = $db->num_rows($result); + $i = 0; - $urladd = "&id=".$_GET["id"]; + $urladd = "&id=".$_GET["id"]; - print_barre_liste("", $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num); + print_barre_liste("", $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num); - print"\n\n"; - print ''; - print ''; - print_liste_field_titre($langs->trans("Bill"),"factures.php","p.ref",'',$urladd,'class="liste_titre"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),"factures.php","s.nom",'',$urladd,'class="liste_titre"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),"factures.php","f.total_ttc","",$urladd,'class="liste_titre" align="center"',$sortfield,$sortorder); - print ''; + print"\n\n"; + print '
 
'; + print ''; + print_liste_field_titre($langs->trans("Bill"),"factures.php","p.ref",'',$urladd,'class="liste_titre"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),"factures.php","s.nom",'',$urladd,'class="liste_titre"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),"factures.php","f.total_ttc","",$urladd,'class="liste_titre" align="center"',$sortfield,$sortorder); + print ''; - $var=false; + $var=false; - $total = 0; + $total = 0; - while ($i < min($num,$conf->liste_limit)) + while ($i < min($num,$conf->liste_limit)) { - $obj = $db->fetch_object($result); + $obj = $db->fetch_object($result); - print "\n"; + print ''.$obj->ref."\n"; - print '\n"; + print '\n"; - print '\n"; + print '\n"; - print '\n"; + print "\n"; - $total += $obj->total_ttc; - $var=!$var; - $i++; + $total += $obj->total_ttc; + $var=!$var; + $i++; } - if($_GET["socid"]) + if($_GET["socid"]) { - print "'; + print ''; - print '\n"; + print '\n"; - print ''; + print ''; - print "\n"; + print "\n"; } - print "
 
"; + print "
"; - print ''; - print img_object($langs->trans("ShowBill"),"bill"); - print ' '; + print ''; + print img_object($langs->trans("ShowBill"),"bill"); + print ' '; - print ''.$obj->ref."'; - print img_object($langs->trans("ShowCompany"),"company"). ' '.stripslashes($obj->nom)."'; + print img_object($langs->trans("ShowCompany"),"company"). ' '.stripslashes($obj->nom)."'.price($obj->total_ttc)."'.price($obj->total_ttc)."'; + print ''; - if ($obj->statut == 0) - { - print '-'; - } - elseif ($obj->statut == 1) - { - print 'Credite'; - } - elseif ($obj->statut == 2) - { - print 'Rejete'; - } + if ($obj->statut == 0) + { + print '-'; + } + elseif ($obj->statut == 1) + { + print 'Credite'; + } + elseif ($obj->statut == 2) + { + print 'Rejete'; + } - print "
"; + print "
"; - print 'TotalTotal'.price($total)."'.price($total)."  
"; - $db->free($result); + print ""; + $db->free($result); } else { - dol_print_error($db); + dol_print_error($db); } $db->close(); diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 78926b68743..898ba1c5db2 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2010 Juanjo Menent * * 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 @@ -25,6 +26,7 @@ */ require('../../main.inc.php'); +require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php"); require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/rejet-prelevement.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php"); @@ -39,59 +41,32 @@ if ($user->societe_id > 0) accessforbidden(); */ llxHeader('',$langs->trans("WithdrawalReceipt")); -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Card"); -$h++; - -if ($conf->use_preview_tabs) -{ - $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"]; - $head[$h][1] = $langs->trans("Preview"); - $h++; -} - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Lines"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Bills"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Rejects"); -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Statistics"); -$h++; - $prev_id = $_GET["id"]; if ($_GET["id"]) { - $bon = new BonPrelevement($db,""); + $bon = new BonPrelevement($db,""); - if ($bon->fetch($_GET["id"]) == 0) + if ($bon->fetch($_GET["id"]) == 0) { - dol_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"), '', 'payment'); + $head = prelevement_prepare_head($bon); + dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalReceipt"), '', 'payment'); - print ''; - print ''; - print '
'.$langs->trans("Ref").''.$bon->getNomUrl(1).'
'; + print ''; + print ''; + print '
'.$langs->trans("Ref").''.$bon->getNomUrl(1).'
'; - print ''; + print ''; } - else + else { - print "Erreur"; + print "Erreur"; } } $page = $_GET["page"]; $rej = new RejetPrelevement($db, $user); + /* * Liste des factures * @@ -116,52 +91,52 @@ $sql.= " ORDER BY pl.amount DESC"; $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - print"\n\n"; - print ''; - print ''; - print ''; - print ''; + print"\n\n"; + print '
'.$langs->trans("Line").''.$langs->trans("ThirdParty").''.$langs->trans("Amount").''.$langs->trans("Reason").''.$langs->trans("ToBill").''.$langs->trans("Invoice").'
'; + print ''; + print ''; + print ''; - $var=True; - $total = 0; - - while ($i < $num) + $var=True; + $total = 0; + + while ($i < $num) { - $obj = $db->fetch_object($resql); + $obj = $db->fetch_object($resql); - print "'; - print '\n"; + print substr('000000'.$obj->rowid, -6); + print ''; + print '\n"; - print '\n"; - print ''; + print '\n"; + print ''; - print ''; - print ''; - print "\n"; + print ''; + print ''; + print "\n"; - $total += $obj->amount; - $var=!$var; - $i++; - } + $total += $obj->amount; + $var=!$var; + $i++; + } - print ''; - print ''; - print '\n"; - print ''; - print "\n
'.$langs->trans("Line").''.$langs->trans("ThirdParty").''.$langs->trans("Amount").''.$langs->trans("Reason").''.$langs->trans("ToBill").''.$langs->trans("Invoice").'
"; - print ' '; - print ''; + print "
"; + print ' '; + print ''; - print substr('000000'.$obj->rowid, -6); - print ''.stripslashes($obj->nom)."'.stripslashes($obj->nom)."'.price($obj->amount)."'.$rej->motifs[$obj->motif].''.price($obj->amount)."'.$rej->motifs[$obj->motif].''.yn($obj->afacturer).''.$obj->fk_facture.'
'.yn($obj->afacturer).''.$obj->fk_facture.'
 '.$langs->trans("Total").''.price($total)." 
\n"; - $db->free($resql); + print ' '; + print ''.$langs->trans("Total").''; + print ''.price($total)."\n"; + print ' '; + print "\n\n"; + $db->free($resql); } else { - dol_print_error($db); + dol_print_error($db); } $db->close(); diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index e39db3dd55b..8373bf23aaa 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -25,6 +25,7 @@ */ require('../../main.inc.php'); +require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php"); require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php"); // Security check @@ -40,35 +41,6 @@ $langs->load("categories"); llxHeader('',$langs->trans("WithdrawalReceipt")); -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Card"); -$h++; - -if ($conf->use_preview_tabs) -{ - $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"]; - $head[$h][1] = $langs->trans("Preview"); - $h++; -} - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Lines"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Bills"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Rejects"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Statistics"); -$hselected = $h; -$h++; - $prev_id = $_GET["id"]; if ($prev_id) @@ -77,7 +49,8 @@ if ($prev_id) if ($bon->fetch($_GET["id"]) == 0) { - dol_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"), '', 'payment'); + $head = prelevement_prepare_head($bon); + dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalReceipt"), '', 'payment'); print ''; diff --git a/htdocs/compta/prelevement/fiche.php b/htdocs/compta/prelevement/fiche.php index 68564a842e7..085adfeaa13 100644 --- a/htdocs/compta/prelevement/fiche.php +++ b/htdocs/compta/prelevement/fiche.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2010 Laurent Destailleur - * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2010 Juanjo Menent * * 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 @@ -26,6 +26,7 @@ */ require('../../main.inc.php'); +require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php"); require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php"); if (!$user->rights->prelevement->bons->lire) @@ -108,37 +109,6 @@ if (GETPOST("action") == 'infocredit') llxHeader('',$langs->trans("WithdrawalReceipt")); -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Card"); -$hselected = $h; -$h++; - -if ($conf->use_preview_tabs) -{ - $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"]; - $head[$h][1] = $langs->trans("Preview"); - $h++; -} - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Lines"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Bills"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Rejects"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Statistics"); -$h++; - -$prev_id = $_GET["id"]; - $html = new Form($db); if ($_GET["id"]) @@ -147,7 +117,8 @@ if ($_GET["id"]) if ($bon->fetch($_GET["id"]) == 0) { - dol_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"), '', 'payment'); + $head = prelevement_prepare_head($bon); + dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalReceipt"), '', 'payment'); if (isset($_GET["error"])) { diff --git a/htdocs/compta/prelevement/lignes.php b/htdocs/compta/prelevement/lignes.php index cd1ebbe07f2..3032be27682 100644 --- a/htdocs/compta/prelevement/lignes.php +++ b/htdocs/compta/prelevement/lignes.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010 Juanjo Menent * * 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 @@ -25,6 +26,7 @@ */ require('../../main.inc.php'); +require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php"); require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/rejet-prelevement.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php"); @@ -41,35 +43,6 @@ $langs->load("categories"); llxHeader('',$langs->trans("WithdrawalReceipt")); -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Card"); -$h++; - -if ($conf->use_preview_tabs) -{ - $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"]; - $head[$h][1] = $langs->trans("Preview"); - $h++; -} - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Lines"); -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Bills"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Rejects"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Statistics"); -$h++; - $prev_id = $_GET["id"]; if ($_GET["id"]) @@ -78,9 +51,8 @@ if ($_GET["id"]) if ($bon->fetch($_GET["id"]) == 0) { - - dol_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"), '', 'payment'); - + $head = prelevement_prepare_head($bon); + dol_fiche_head($head, 'lines', $langs->trans("WithdrawalReceipt"), '', 'payment'); print '
'; diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index 41dd6782f05..3b79241a22b 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010 Juanjo Menent * * 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 @@ -41,26 +42,6 @@ $result = restrictedArea($user, 'prelevement','','','bons'); llxHeader('',$langs->trans("WithdrawsRefused")); -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Card"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Bills"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/rejets.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Rejects"); -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Statistics"); -$h++; - -$prev_id = $_GET["id"]; - $page = $_GET["page"]; $sortorder = $_GET["sortorder"]; $sortfield = $_GET["sortfield"]; @@ -94,46 +75,46 @@ $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $ $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result); - $i = 0; + $num = $db->num_rows($result); + $i = 0; - print_barre_liste($langs->trans("WithdrawsRefused"), $page, "rejets.php", $urladd, $sortfield, $sortorder, '', $num); - print"\n\n"; - print '
'; - print ''; - print_liste_field_titre($langs->trans("Nb"),"rejets.php","p.ref",'',$urladd); - print_liste_field_titre($langs->trans("ThirdParty"),"rejets.php","s.nom",'',$urladd); - print_liste_field_titre($langs->trans("Reason"),"rejets.php","pr.motif","",$urladd); - print ''; + print_barre_liste($langs->trans("WithdrawsRefused"), $page, "rejets.php", $urladd, $sortfield, $sortorder, '', $num); + print"\n\n"; + print '
'; + print ''; + print_liste_field_titre($langs->trans("Nb"),"rejets.php","p.ref",'',$urladd); + print_liste_field_titre($langs->trans("ThirdParty"),"rejets.php","s.nom",'',$urladd); + print_liste_field_titre($langs->trans("Reason"),"rejets.php","pr.motif","",$urladd); + print ''; - $var=True; + $var=True; - $total = 0; + $total = 0; - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($result); + while ($i < min($num,$conf->liste_limit)) + { + $obj = $db->fetch_object($result); - print ""; + print substr('000000'.$obj->rowid, -6).""; - print '\n"; + print '\n"; - print ''; - print "\n"; - $var=!$var; - $i++; - } + print ''; + print "\n"; + $var=!$var; + $i++; + } - print "
"; - print ' '; - print ''; + print "
"; + print ' '; + print ''; - print substr('000000'.$obj->rowid, -6)."'.stripslashes($obj->nom)."'.stripslashes($obj->nom)."'.$rej->motifs[$obj->motif].'
'.$rej->motifs[$obj->motif].'
"; - $db->free($result); + print ""; + $db->free($result); } else { - dol_print_error($db); + dol_print_error($db); } $db->close(); diff --git a/htdocs/lib/prelevement.lib.php b/htdocs/lib/prelevement.lib.php new file mode 100644 index 00000000000..47f8152bc4a --- /dev/null +++ b/htdocs/lib/prelevement.lib.php @@ -0,0 +1,95 @@ + + * + * 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. + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/lib/prelevement.lib.php + * \brief Ensemble de fonctions de base pour le module prelevement + * \ingroup propal + * \version $Id$ + * + * Ensemble de fonctions de base de dolibarr sous forme d'include + */ + + +/** + * Prepare head for prelevement screen and return it + * @param prelevement class BonPrelevement + * @return array head + */ +function prelevement_prepare_head($prelevement) +{ + global $langs, $conf, $user; + $langs->load("withdrawals"); + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$prelevement->id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'prelevement'; + $h++; + + if ($conf->use_preview_tabs) + { + $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$prelevement->id; + $head[$h][1] = $langs->trans("Preview"); + $head[$h][2] = 'preview'; + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$prelevement->id; + $head[$h][1] = $langs->trans("Lines"); + $head[$h][2] = 'lines'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$prelevement->id; + $head[$h][1] = $langs->trans("Bills"); + $head[$h][2] = 'invoices'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$prelevement->id; + $head[$h][1] = $langs->trans("Rejects"); + $head[$h][2] = 'rejects'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$prelevement->id; + $head[$h][1] = $langs->trans("Statistics"); + $head[$h][2] = 'statistics'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); + if (is_array($conf->tabs_modules['prelevement'])) + { + $i=0; + foreach ($conf->tabs_modules['prelevement'] as $value) + { + $values=explode(':',$value); + if ($values[2]) $langs->load($values[2]); + $head[$h][0] = DOL_URL_ROOT . preg_replace('/__ID__/i',$propal->id,$values[3]); + $head[$h][1] = $langs->trans($values[1]); + $head[$h][2] = 'tab'.$values[1]; + $h++; + } + } + + return $head; +} +?> \ No newline at end of file